less than serious - PreludeExts
Iavor S. Diatchki
diatchki at cse.ogi.edu
Fri Jan 16 10:00:44 EST 2004
hi,
just out of curiosity, have you found any uses for the adjunction class?
i spent quite a bit of time playing with adjunctions and they are very
useful,
but i haven't been able to find particulalry appealing programming examples.
this is how i formulated them in haskell:
class Functor u => Adjunction f u | f -> u, u -> f where
ret :: a -> u (f a)
bind :: f a -> (a -> u b) -> b
run :: Adjunction f u => f (u a) -> a
run m = m `bind` id
liftF :: Adjunction f u => (a -> b) -> f a -> f b
liftF f m = m `bind` \a -> ret (f a)
cobind :: Adjunction f u => a -> (f a -> b) -> u b
a `cobind` f = fmap f (ret a)
-iavor
Shae Matijs Erisson wrote:
>In the true spirit of wikiwiki comes PreludeExts, all the tiny useful bits of
>code you think should be in the Prelude, but aren't.
>
>http://www.haskell.org/hawiki/PreludeExts
>
>Anyway, this started when someone on #haskell wanted a permutations function
>for the Nth time. I read Koen's "this should be in the Prelude" comment for the
>Nth time, and PreludeExts was born.
>
>If you have small (or not so small) generally useful bits of code, you are
>invited to put them onto the PreludeExts page.
>
>
--
==================================================
| Iavor S. Diatchki, Ph.D. student |
| Department of Computer Science and Engineering |
| School of OGI at OHSU |
| http://www.cse.ogi.edu/~diatchki |
==================================================
More information about the Libraries
mailing list