
7 Jul
2010
7 Jul
'10
7:19 a.m.
What if I want to check if a variable uses a particular constructor, but I don't want to unpack it. For example: data Item = Note Int Float Rational [Int] [Float] | Dynamic Int And I want to write doSomething :: Maybe Result doSomething item = case item of note@(Note _ _ _ _ _) -> Just $ process note _ -> Nothing But I don't like writing "Note _ _ _ _ _" Thanks, Mike