Search code examples
haskelltypesoperator-precedencetype-level-computation

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?


Solution

  • You can make a synonym:

    {-# LANGUAGE TypeOperators #-}
    
    infixr 1 ~>
    type (~>) = (->)