Skip to content

Instantly share code, notes, and snippets.

@evancz
Created June 5, 2014 05:43
Show Gist options
  • Save evancz/48221fe7330a6887595f to your computer and use it in GitHub Desktop.
Save evancz/48221fe7330a6887595f to your computer and use it in GitHub Desktop.
snippetFromTheCompiler = with errorAndIO
let importedVars <- mapM (canonicalizeValues env) (Map.toList interfaces)
allTypes = concat (ctors : importedVars)
vars = concatMap (fst . snd) allTypes
header = Map.map snd (Map.fromList allTypes)
environ = noneNoDocs . T.CLet [ T.Scheme vars [] (noneNoDocs T.CTrue) header ]
fvar <- liftIO $ T.var T.Flexible
c <- TcExpr.constrain env (program moduleBody) (T.varN fvar)
return (header, environ c)
snippetFromTheCompiler = do
importedVars <- mapM (canonicalizeValues env) (Map.toList interfaces)
let allTypes = concat (ctors : importedVars)
vars = concatMap (fst . snd) allTypes
header = Map.map snd (Map.fromList allTypes)
environ = noneNoDocs . T.CLet [ T.Scheme vars [] (noneNoDocs T.CTrue) header ]
fvar <- liftIO $ T.var T.Flexible
c <- TcExpr.constrain env (program moduleBody) (T.varN fvar)
return (header, environ c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment