I am working on a library where I want to define a recursive class that I have simplified here to:
{-
This allows me, for example,
*Main Data.Label> let f = runStack $ Snoc (Snoc Top fst) head :: [(a,x)] -> a *Main Data.Label> f [('a',undefined)] 'a'
But this seems to require careful use of type annotations, otherwise ...
*Main Data.Label> let f = runStack $ Snoc (Snoc Top fst) head <interactive>:1:1: No instance for (StackTo a0 Top b0) arising from a use of `runStack' Possible fix: add an instance declaration for (StackTo a0 Top b0) In the expression: runStack In the expression: runStack $ Snoc (Snoc Top fst) head In an equation for `it': it = runStack $ Snoc (Snoc Top fst) head
I think that these are the same problems that were discussed in this issue , but it is difficult for me to adapt this solution here. Can I use type families or some other method to come up with a more user-friendly solution for my recursive continuation stack?
source share