Many functions can be generalised
David Feuer
david.feuer at gmail.com
Sun Dec 4 05:44:31 UTC 2016
On Dec 4, 2016 12:22 AM, "David Menendez" <dave at zednenem.com> wrote:
You can also use it with contra-variant or invariant type constructors,
e.g.,
instance Siftable a (a -> Bool) where
sift f g = \x -> f x && g x
That looks backwards for your composition law, but I'm a bit tired so I
wouldn't swear to it.
Surely you can do the same with the constructor class.
newtype Ab a = Ab (a -> Bool)
instance Siftable Ab where
siftAway _ = Ab (const False)
sift p (Ab g) = Ab ...
I'm not sure if my siftAway excludes anything it shouldn't....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161204/621a37bf/attachment-0001.html>
More information about the Libraries
mailing list