Created
February 12, 2015 00:40
-
-
Save mgsloan/53d7fa50338c696e5c80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ runhaskell TestAddTopDecls.hs | |
TestAddTopDecls.hs:5:14: | |
GHC internal error: ‘one_a2M1’ is not in scope during type checking, but it passed the renamer | |
tcl_env of environment: [] | |
In the first argument of ‘print’, namely ‘one_a2M1’ | |
In the expression: print one_a2M1 | |
In an equation for ‘main’: main = print one_a2M1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell #-} | |
import AddTopDecls | |
main = print $testAddTopDecls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell #-} | |
module AddTopDecls where | |
import Language.Haskell.TH.Syntax | |
-- Causes a GHC internal error. | |
testAddTopDecls = do | |
n <- newName "one" | |
addTopDecls [FunD n [Clause [] (NormalB (LitE (IntegerL 1))) []]] | |
return (VarE n) | |
-- This is a separate issue. I would expect this one to work, but I'm | |
-- guessing that 'addTopDecls' doesn't erase the uniqueness of names, | |
-- or something along those lines. | |
testAddTopDecls' = do | |
addTopDecls =<< [d| one = 1 |] | |
return (VarE (mkName "one")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment