[Haskell-cafe] Re: [Haskell] Re: View patterns in GHC: Request for
feedback
Claus Reinke
claus.reinke at talk21.com
Tue Jul 24 14:33:51 EDT 2007
>> 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
More information about the Haskell-Cafe
mailing list