I had previously written a function that seems to work, but unfortunately I didn't write the code very nicely, and now have to figure it out again [that I'm modifying the monad transformer stack I'm working with].
run_astvn ::
LowerMonadT (StateT LowerSketchData Identity) β
-> Seq SketchAST
run_astvn x = get_ast2 $ runIdentity $
runStateT (runStateT (runStateT x empty) empty)
(LowerSketchData Set.empty)
where get_ast2 = snd . fst
I want to get the concrete type of get_ast2
. I seem to be able to add the flag -ddump-simpl
and grep through my terminal output until I find, (cleaned up a little)
(((β, Seq SketchAST), Seq SketchAST), LowerSketchData) -> Seq SketchAST
(Sorry this is likely nonsense to everyone else, but the point is it is useful for me.) Is there a faster / more convenient way to do this? In case it's not obvious, what I mean by "concrete" in this case is that the above type is useful; knowing the type of snd . fst
is not :).
There's two ways I know of to do this currently, and they're both sort of hacks. The first is to use implicit parameters:
Then, in ghci:
The other way is to give an intentionally wrong type signature and check how the compiler complains.
This gives the error:
Changing the wrong type to
() -> ()
:So now we know the type should look like
(((β, Seq SketchAST), Seq SketchAST), LowerSketchData) -> ()
. One last iteration gets rid of the final()
, because the compiler complains that:...so the other
()
should beSeq SketchAST
.