Skip to content

Instantly share code, notes, and snippets.

@munro
Last active August 29, 2015 14:00
Show Gist options
  • Save munro/11383147 to your computer and use it in GitHub Desktop.
Save munro/11383147 to your computer and use it in GitHub Desktop.
-- How do I force evaluation when working with monadic values? :(
type HeapPtr = Integer
type VMVariable = String
__fn_0 :: [VMVariable] -> VMVariable
createFunction :: ([VMVariable] -> VMVariable) -> VMState VMVariable
setProp :: HeapPtr -> VMVariable -> VMVariable -> VMState ()
vmMain = do
-- works, forces evaluation... IRC says I have to do this >_<
myFn <- (createFunction __fn_0);
_ <- setProp __my_scope "A" myFn;
-- doesn't work, "A" function never appears on heap :(
_ <- (setProp __my_scope "A") <$> (createFunction __fn_0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment