Skip to content

type operator precedences don't work in contexts

Type contexts don't parse correctly when a type class is used infix. The following example:

>    infixr 4 :=:
>    infixl 3 :+:
>    infix 2 `Disjoint`
>
>    labelZip :: (n :=: a `Disjoint` m :=: b) 
>             => n -> m -> [a] -> [b] -> [n :=: a :+: m :=: b]

gives the error:

    Type constructor `:=:' used as a class
    In the type `(:=: n (a Disjoint (m :=: b))) =>
                 n -> m -> [a] -> [b] -> [(n :=: a) :+: (m :=: b)]'
    In the type signature for `labelZip':
      labelZip :: (:=: n (a Disjoint (m :=: b))) =>
                  n -> m -> [a] -> [b] -> [(n :=: a) :+: (m :=: b)]

where the parenthesised version works.

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information