Skip to content

Can't infer constraint of pattern synonyms

Can't infer constraint of:

-- pattern Real' :: Num a => a -> Complex a
pattern Real' r <- r :+ _
  where Real' r =  r :+ 0
teR4.hs:12:25: error: …
    • No instance for (Num t) arising from the literal ‘0’
      Possible fix:                        
        add (Num t) to the context of
          the type signature for:    
            Main.$bReal' :: t -> Complex t
    • In the second argument of ‘(:+)’, namely ‘0’
      In the expression: r :+ 0
      In an equation for ‘$bReal'’: $bReal' r = r :+ 0
Compilation failed.

Should it be able to?

Trac metadata
Trac field Value
Version 8.1
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