[Haskell-cafe] ANN: generic-church-0.1.0.1

Danny Gratzer danny.gratzer at gmail.com
Wed Mar 12 05:49:32 UTC 2014


Hi cafe!

I'm happy to announce the first release of
generic-church<http://hackage.haskell.org/package/generic-church-0.1.0.1>.
A small library for converting types equipped with a [GHC.Generic] instance
back and forth between their church representations automatically.

For example

  > let x :: a -> (Int -> a) -> a; x = toChurch $ Just 1
  > x False (const True)
     True

And we can go the other way with [fromChurch]

  > fromChurch (\_ f -> f 1) :: Maybe Int
     1

If you're interested in the typeclass/family hacking behind the scenes,
I've blogged a <http://jozefg.bitbucket.org/posts/2014-03-06-church.html>
few <http://jozefg.bitbucket.org/posts/2014-03-07-church-the-sequel.html>
times<http://jozefg.bitbucket.org/posts/2014-03-10-revenge-of-churchrep.html>about
it.

Cheers,
Danny Gratzer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140312/c3b1f2bc/attachment.html>


More information about the Haskell-Cafe mailing list