Skip to content

Making function as parameter polymorphic #205

Answered by jhgarner
flip111 asked this question in Q&A
Discussion options

You must be logged in to vote

I think using a separate es2 is on the right track. The following code compiles for me (with stubs tossed in for the extra types). The interesting change is on the let x =.... line. The trick is making sure that x works with any effect stack instead of forcing it to be something specific. I also had to change the type signature of runProg slightly to get the same error as you. I'm guessing that was a typo, but let me know if not.

type Eval es v = (Error EvalMonadError :> es, State (EvalMonadState v) :> es)

evalProg :: forall es v. EvalTarget v => [Proc] -> [v] -> String -> [v] -> Eff (Error String : es) (StateMachine v, [v])
evalProg procs vs main args =
  let x = ((evalProc @v @es2) mai…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@flip111
Comment options

Answer selected by flip111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants