Shou
Shou

Reputation: 2009

Change fixity of function type (->)?

Doing some type-level computation I've come to a point where I want to change the fixity of -> because it can't be mixed with left associative type operators of fixity 0. I know it doesn't work outright with the TypeOperators extension and infixr 1 ->, because it only returns the error parse error on input ‘->’.

Is there any extension or other means to modify the fixity of the function type operator?

Upvotes: 10

Views: 334

Answers (1)

effectfully
effectfully

Reputation: 12715

You can make a synonym:

{-# LANGUAGE TypeOperators #-}

infixr 1 ~>
type (~>) = (->)

Upvotes: 13

Related Questions