Sun Mar 4 11:33:10 CET 2018

Erlang harness

Should be an overlay for Erlang code: types specified in Erlang to be
translated to Haskell automatically.  TODO: extend routines used for
expect tests.


- special handling for singleton products
- no maps
- sum types need data definitions

Seems to work.
Other way: is there a haskell library to represent type syntax?
Likely yes, but might be overkill.

EDIT: This allows type-directed programming.

1. Define types in Erlang.  Use proper ADTs by:
   - creating type aliases for all products
   - create sums by using unions only at top level

2. Import types in Haskell, and write functions that implement the

3. Use abstract evaluation to produce Erlang code.

EDIT: sum types

146> hs:x("-type t(A) :: left(A) | right(A).").
<<"data T(a) = Left (Left(a)) | Right (Right(a))">>
    constructor----  ----alias

Note that to do this without monads in the type descriptions, the CCC
loophole is needed!  This could translate the types to a monadic type.

EDIT: Move most of this to Haskell.  Dump syntax as Erlang binary --
just use the Erlang parser.  Then import in Haskell and reify the
types there.