Anyone know of a library that can take some type definitions like this:
data ABC
= A A
| B B
| C C
data A = A { a1 :: Int, a2 :: String }
data B = B { b1 :: String }
data C = C { c1 :: Int, c2 :: Int, c3 :: String }
and with the least amount of work possible, give me equivalent definitions with certain positions substituted with type parameters? e.g. suppose I want to have a2 and c3 substituted with type parameters, which should give me:
data ABC s
= A (A s)
| B B
| C (C s)
data A s = A { a1 :: Int, a2 :: s }
data B = B { b1 :: String }
data C s = C { c1 :: Int, c2 :: Int, c3 :: s }
Hold on, how do those definitions make sense? Surely they’d give an error about multiple declarations? (Unless this is meant to be some sort of pseudocode-ish simplification…)
Anyone know of a library that can take some type definitions like this:
and with the least amount of work possible, give me equivalent definitions with certain positions substituted with type parameters? e.g. suppose I want to have
a2
andc3
substituted with type parameters, which should give me:did you check out if retrie supports something like this?
I kind of doubt it, but that's the only thing that comes to mind
Hold on, how do those definitions make sense? Surely they’d give an error about multiple declarations? (Unless this is meant to be some sort of pseudocode-ish simplification…)
I believe it is supposed to be pseudocode, but it is unfortunate Haskell doesn't accept overloading constructors like Agda does.