[Haskell-cafe] Point-free style in guards
Luke Palmer
lrpalmer at gmail.com
Tue Jul 22 18:39:24 EDT 2008
2008/7/22 J.N. Oliveira <jno at di.uminho.pt>:
> But you still need the extra parentheses...
Not so!
infixl 0 .|
infixl 0 .|... -- 'otherwise' construct
infix 1 .=
(.=) :: (a -> Bool) -> (a -> b) -> (a -> Maybe b)
(.|) :: (a -> Maybe b) -> (a -> Maybe b) -> (a -> Maybe b)
(.|...) :: (a -> Maybe b) -> (a -> b) -> (a -> b)
-- implementations left as exercise for the reader
outStanza = isMessage .= outMessage
.| isPresence .= outPresence
.| isIQ .= outIQ
.|... const 42
Hooray for abusing operators!
Luke
More information about the Haskell-Cafe
mailing list