id summary reporter owner description type status priority milestone component version resolution keywords cc os architecture failure testcase blockedby blocking related differential wikipage
13454 Operators not allowed as fields in Record Pattern Synonyms Iceland_jack "I want to write the following record pattern synonym
{{{#!hs
pattern MkOp :: Op -> Exp -> Exp -> Exp
pattern MkOp {(·), a, b} <- (splitOp -> Just ((·), a, b))
where MkOp (·) a b = a · b
}}}
given this code
{{{#!hs
data Exp = Val Int | Add Exp Exp | Mul Exp Exp deriving Show
type Op = Exp -> Exp -> Exp
splitOp :: Exp -> Maybe (Op, Exp, Exp)
splitOp (Add a b) = Just (Add, a, b)
splitOp (Mul a b) = Just (Mul, a, b)
splitOp _ = Nothing
}}}
It works fine if `(·)` is replaced by `operator`. Fields of regular data types works just fine:
{{{#!hs
data F a = F {
(·) :: a -> a -> a,
x :: a,
y :: a
}
f F{(·), x, y} = x·y
g F{..} = x·y
}}}" bug closed normal 8.4.1 Compiler 8.0.1 fixed PatternSynonyms Unknown/Multiple Unknown/Multiple None/Unknown Phab:D3379