Skip to content

Fixity declarations for pattern synonyms not persisted

It appears fixity declarations for pattern synonyms only affect modules being compiled in the same run as the module the definition is in. For example, take the following files:

Foo.hs:

{-# LANGUAGE PatternSynonyms #-}
module Foo where

data Type = Type Int RawType

data RawType = Product Type Type
             | Num

pattern a :*: b <- Type _ (Product a b)
infixr 7 :*:

Bar.hs:

{-# LANGUAGE PatternSynonyms #-}
module Main where

import Foo

value = Type 0 $ Product (Type 1 Num) $ Type 2 $ Product (Type 3 Num) $ Type 4 Num

somethingElse = 23

main = case value of
           _ :*: _ :*: _ -> putStrLn "Success"
           _             -> putStrLn "Fail"

On the first compile, the executable will print "Success". Modifying Bar and recompiling will result in it printing "Fail". Modifying both and recompiling results in "Success" again.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information