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
module A where | |
class C a where | |
foo :: a -> String | |
instance C Int where | |
foo _ = "int" |
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 FlexibleInstances #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module B where | |
import A | |
import Language.Haskell.TH | |
instance C a => C [a] where | |
foo _ = "list" | |
me :: Q (TExp ([Int] -> String)) | |
me = [|| foo ||] |
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 FlexibleInstances #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module C where | |
import A | |
import Language.Haskell.TH | |
instance {-# OVERLAPPING #-} C [Int] where | |
foo _ = "list2" | |
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 #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module D where | |
import A | |
import B | |
import C | |
main2 = $$(me) [1 :: Int] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment