diff options
| author | Ian Lynagh <igloo@earth.li> | 2009-06-05 12:29:29 +0000 |
|---|---|---|
| committer | Ian Lynagh <igloo@earth.li> | 2009-06-05 12:29:29 +0000 |
| commit | 77a4675ae3ba1c53d60b54cc23316f764cae281e (patch) | |
| tree | f047a83287262d0193e8140b16acbc510c251469 | |
| parent | 8bf9fcc6529cac5fd4699909757b8e094118e5e4 (diff) | |
| download | haskell-77a4675ae3ba1c53d60b54cc23316f764cae281e.tar.gz | |
Update the docs on how you bind unlifted types in let/where clauses
| -rw-r--r-- | docs/users_guide/glasgow_exts.xml | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index a08ace929f..e8e721c36b 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -210,22 +210,20 @@ in a <emphasis>top-level</emphasis> binding. in a <emphasis>recursive</emphasis> binding. </para></listitem> <listitem><para> You may bind unboxed variables in a (non-recursive, -non-top-level) pattern binding, but any such variable causes the entire -pattern-match -to become strict. For example: +non-top-level) pattern binding, but you must make any such pattern-match +strict. For example, rather than: <programlisting> data Foo = Foo Int Int# f x = let (Foo a b, w) = ..rhs.. in ..body.. </programlisting> -Since <literal>b</literal> has type <literal>Int#</literal>, the entire pattern -match -is strict, and the program behaves as if you had written +you must write: <programlisting> data Foo = Foo Int Int# - f x = case ..rhs.. of { (Foo a b, w) -> ..body.. } + f x = let !(Foo a b, w) = ..rhs.. in ..body.. </programlisting> +since <literal>b</literal> has type <literal>Int#</literal>. </para> </listitem> </itemizedlist> |
