| ... | ... | @@ -78,3 +78,37 @@ would be equivalant to |
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
## open statement
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
having the ability to 'open' a record bringing all its values into scope would be useful for techniques such as first class modules when combined with [PolymorphicComponents](polymorphic-components). a proposal is
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
|
|
|
|
data Record = Record { foo :: Int, bar :: String }
|
|
|
|
|
|
|
|
f :: Record -> Int
|
|
|
|
f x = ... where
|
|
|
|
open x
|
|
|
|
ans = ...
|
|
|
|
|
|
|
|
will desugar to
|
|
|
|
|
|
|
|
f x = ... where
|
|
|
|
Record { foo = foo } = x
|
|
|
|
Record { bar = bar } = x
|
|
|
|
ans = ...
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
open x would be allowed at the top level, in a let binding, or in a where binding.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}}}
|
|
|
|
|
|
|
|
|