Skip to content

Instantly share code, notes, and snippets.

@Ebmtranceboy
Created May 8, 2020 03:35
Show Gist options
  • Save Ebmtranceboy/8310c59bc763026718b6d35240cef4bb to your computer and use it in GitHub Desktop.
Save Ebmtranceboy/8310c59bc763026718b6d35240cef4bb to your computer and use it in GitHub Desktop.
module Main where
import Prelude
type Make m =
{
make :: forall x . m x
}
type Context m r =
{
bm :: Make m | r
}
test :: forall m r. (Monad m) => Context m r -> m Unit
test ctx = do
-- works fine
_ <- ctx.bm.make
-- bm seems to have a different type after deconstruction because this fails to compile
let { bm } = ctx
_ <- bm.make
-- this again works
let { bm: bm' :: Make m } = ctx
_ <- bm'.make
-- this works too
let { bm: bm'' :: { make :: forall x . m x }} = ctx
_ <- bm''.make
pure unit
main = pure unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment