dmw64
dmw64

Reputation: 495

Symbolic name as type constructor

Sorry, a newbie's question about Haskell...

What do I have to do to use an infix-symbol as a type constructor? I've found the following piece of code, but ghc and ghci complain "Unexpected type `~>' where type variable expected"...

class Category (~>) where
(.) :: (a ~> b) -> (b ~> c) -> (a ~> c)
id  :: a ~> a

How can this be done? Thanks a lot in advance!

Upvotes: 4

Views: 310

Answers (2)

user824425
user824425

Reputation:

As of GHC 7.6, all TypeOperators are always constructors. I'm not sure why this is, but I guess this breaking change is to avoid breaking even older code. More info in the mailing list.

Upvotes: 6

hugomg
hugomg

Reputation: 69944

Infix type constructors need to begin with a :. Try rewriting your code to use :~>

http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/data-type-extensions.html

Upvotes: 0

Related Questions