Exposing newtype coercions to Haskell

Joachim Breitner mail at joachim-breitner.de
Thu Jul 11 16:24:46 CEST 2013


Hi,

despite my issues with recursive data types, I continued with the
implementation.

I now added the check if the data type arguments can safely be coerced.
I do not scan what is in scope for NT values to use, but rather expect
the progammer to promise the required witness when he uses "deriving"
and the plug the functions together by himself:
https://github.com/nomeata/nt-coerce/blob/ec9b5/tests/LiftAbstract.hs

I also added a test suite to show what works already:
https://github.com/nomeata/nt-coerce/tree/master/tests
what does rightfully not work, due to abstraction:
https://github.com/nomeata/nt-coerce/tree/master/tests/failing
and what does not yet work, although it conceivably should:
https://github.com/nomeata/nt-coerce/tree/master/tests/todo

The test suite contains expected output in *.out and *.err, so you can
check out what happens without having to run it. The error messages are
not yet as nice as they should be.

How to proceed from here Is this approach and design good enough to to
into GHC, despite not being able to handle _all_ cases where it
conceivably could, and the slight unwieldiness when coerctions for data
types based on abstract data types?

BTW, I find it quite nice to be able to develop such a feature without
touching GHC’s source. If that is possible for more contributions, the
entry barrier to GHC would be noticeably lowered.

Thanks,
Joachim


-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttp://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0x4743206C
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130711/3c548efa/attachment.pgp>


More information about the ghc-devs mailing list