[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for
feedback
Jules Bean
jules at jellybean.co.uk
Wed Jul 25 04:59:50 EDT 2007
apfelmus wrote:
> IMHO, the long-time debate about views is not whether they're useful (I
> think they are!) but which concrete form to choose. Unfortunately, all
> of the proposals so far are somehow like Dr. Jekyll and Mr. Hyde: one
> side is nice but the other is rather ugly.
>
> In the end, I might end up using the currently proposed pattern views,
> not because I'm fond of the proposal but simply because they're
> implemented and the pain of not using views is too big.
Maybe it would be helpful if Simon M would give a bit more flesh to the
bones of his suggestion that all the examples in the proposal can be
done more concisely without them.
apfelmus: Have you tried using pattern guards for views?
f s | y <: ys <- viewl s = ....
| EmptyL <- viewl s = ....
(did I get that right? :)
Personally I thought the basic proposal is quite nice, but the extra
sugar for Maybes and tuples looked a bit ugly...
Jules
More information about the Haskell-Cafe
mailing list