[Haskell] Do the libraries define S' ?
Andrew Pimlott
andrew at pimlott.net
Wed Jul 7 14:45:01 EDT 2004
On Wed, Jul 07, 2004 at 01:18:54PM +0100, Graham Klyne wrote:
> There's a pattern of higher-order function usage I find myself repeatedly
> wanting to use, exemplified by the following:
>
> [[
> -- combineTest :: (Bool->Bool->Bool) -> (a->Bool) -> (a->Bool) -> (a->Bool)
> combineTest :: (b->c->d) -> (a->b) -> (a->c) -> a -> d
> combineTest c t1 t2 = \a -> c (t1 a) (t2 a)
>
> (.&.) :: (a->Bool) -> (a->Bool) -> (a->Bool)
> (.&.) = combineTest (&&)
This can be seen as liftM2 on the reader monad ((->) r):
(.&.) = liftM2 (&&)
t1 = (>0) .&. (<=4)
ans = t1 3 == True
Andrew
More information about the Haskell
mailing list