pa-ba / compdata

Haskell library implementing "Data Types a la Carte"
http://hackage.haskell.org/package/compdata
Other
89 stars 27 forks source link

Coalgebra examples for multi #26

Open tscholak opened 6 years ago

tscholak commented 6 years ago

I find myself having a lot of trouble figuring out how to generate terms for mutual recursive data types. Unfortunately, there are no coalgebra examples for the multi modules. It would be really helpful if there were an example of, for instance, randomly sampling terms of

data Value a i where
  Const ::        Int -> Value a Int
  Pair  :: a i -> a j -> Value a (i,j)

I had a look at the GenTyped class and instances, https://github.com/pa-ba/compdata/blob/master/benchmark/DataTypes/Comp.hs#L111-L171, but I find porting them to mutual recursive terms highly nontrivial.