stefan at vectorfabrics.com
Wed Apr 20 15:35:43 CEST 2011
Regarding the note you attached to the Trac ticket on the pretty-printing of kind ascriptions (http://hackage.haskell.org/trac/ghc/ticket/5141#comment:2):
> Note, though, that it's likely that we're considering making operators
> like '*' into type ''constructors'' rather that type ''variables'. This
> is inconsitent with terms, but is jolly convenient:
> data a + b = Left a | Right b
> Of course there'll be a flag. But let us know if you think that having
> operators be type variables is very useful. (I tend to think it's more
> confusing than useful.)
I myself am perfectly alright with being "forced" to write
data a :+: b = Left a | Right b
Although I don't have a *convincing* example of the usefulness of operators as type variables, I like the idea of consistency with the term level: IMO it keeps things predictable.
And even as it may not qualify as convincing, I do remember having written code similar to
data (f :+: g) a = Inl (f a) | Inr (g a)
data (f :*: g) a = f a :*: g a
class FunctorOp ((&) :: (* -> *) -> (* -> *) -> (* -> *)) where ...
instance FunctorOp (:+:) where ...
instance FunctorOp (:*:) where ...
class FunctorOp (&) => CommOp (&) where comm :: f & g -> g & f
instance CommOp (:+:) where ...
instance CommOp (:*:) where ...
f :: (CommOp (&), Functor f, Functor g) -> f & g -> ...
f ... = ...
All this, of course, just to put in my tuppence worth.
More information about the Glasgow-haskell-users