When I have some function of type like
f :: (Ord a) => a -> a -> Bool
f a b = a > b
I should like make function which wrap this function with not.
e.g. make function like this
g :: (Ord a) => a -> a -> Bool
g a b = not $ f a b
I can make combinator like
n f = (a -> -> not $ f a b)
But I don't know how.
*Main> let n f = (a -> -> not $ f a b)
n :: (t -> t1 -> Bool) -> t -> t1 -> Bool
Main> :t n f
n f :: (Ord t) => t -> t -> Bool
*Main> let g = n f
g :: () -> () -> Bool
What am I doing wrong?
And bonus question how I can do this for function with more and lest parameters e.g.
t -> Bool
t -> t1 -> Bool
t -> t1 -> t2 -> Bool
t -> t1 -> t2 -> t3 -> Bool
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…