2011/10/5 Simon Peyton-Jones <[email protected]>:
> | In the spirit of "don't let the perfect be the enemy of the good"
> | though, I'm solidly in favor of the original proposal as it is.
>
> This is my thought too. George is proposing to extend Haskell's existing
> mechanism for numeric literals (namely, replace 4 by (fromInteger
> (4::Integer))), so that it works for lists, just as Lennart did for Strings.
> One could do more, as Yitz has suggested, but that would be an altogether
> bigger deal, involving Template Haskell and quite a bit of new design; and if
> done should apply uniformly to numeric and string literals too.
>
> So personally I favour George's general approach as a first step. But here
> is one thought. In the spirit of monad comprehensions, should we not treat
> [a,b,c]
> as short for
> return a `mappend` return b `mappend` return c
> so that [a,b,c] syntax is, like [ e | x <- xs ] syntax, just short for
> monadic goop. Then we would not need a new class at all, which would be nice.
I prefer the flexibility of George's proposal. Of the examples from
his email, the only one this design works for is [a].
>
> That isn't quite what Roman was suggesting (he wanted to supply the 'cons'
> and 'nil') but it's closer, less "head-biased", and it seems to fit the
> spirit of monad comprehensions.
>
> I'm not sure if this plan would support [("fred",45), ("bill",22)] :: Map
> String Int. Probably not. Maybe that's a shortcoming... but such Maps are
> a rather surprising use of list literals.
>
> Simon
>
>
--
Work is punishment for failing to procrastinate effectively.
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users