
24 Jul
2007
24 Jul
'07
2:33 p.m.
unit :: Typ -> Maybe () arrow :: Type -> Maybe (Typ,Typ) size :: Typ -> Integer size (unit -> ()) = 1 size (arrow -> (t1,t2)) = size t1 + size t2
Though I guess you would not object to:
size (unit -> Just ()) = 1 size (arrow -> Just (t1,t2)) = size t1 + size t2 ?
actually, i might!-) it is not just that, in general, you have to invent and declare those intermediate view types, but that their use obscures the overall pattern, once you start nesting abstract and concrete patterns (and if you don't nest them, view patterns don't add much). claus