[Haskell-cafe] A better syntax for qualified operators?
Bas van Dijk
basvandijk at home.nl
Wed Sep 27 18:39:13 EDT 2006
On Wednesday 27 September 2006 22:20, Brian Hulley wrote:
> (The other change needed for LL(1) is to give contexts a marker before they
> appear eg:
>
> foo :: {MonadIO m} a -> m a
> )
Or move contexts to the end of a type and separate it with a | like Clean
does: (See 6.2 of http://clean.cs.ru.nl/download/Clean20/doc/CleanRep2.0.pdf)
foo :: a -> m a | MonadIO m
Personally I like this style because I always think first about what the type
of the function should be (a -> m a) and then about the contexts /
restrictions that hold for the variables (MonadIO).
I do the same thinking when writing list comprehensions. First I think of the
general form of the elements in the list: [ (a, b) ...
then I think about the restrictions on the variables: | a <- [1..10], b <-
[1..10], a > b]
Bas van Dijk
More information about the Haskell-Cafe
mailing list