Created
February 3, 2020 14:41
-
-
Save viercc/eb6a4231636f91c89ee934d0ae425ba2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| -- Breaking first-class-instances | |
| {-# | |
| LANGUAGE | |
| TemplateHaskell, | |
| RankNTypes, | |
| TypeFamilies, | |
| KindSignatures, | |
| FlexibleInstances, | |
| ConstraintKinds | |
| #-} | |
| module Main where | |
| import FCI | |
| class Foo a where | |
| foo :: a -> String | |
| mkInst ''Foo | |
| instance Foo String where | |
| foo = ("top:" ++) | |
| main :: IO () | |
| main = do | |
| putStrLn $ | |
| Foo ("outer:" ++) ==> Foo ("inner:" ++) ==> foo (foo "") | |
| putStrLn $ | |
| Foo ("outer:" ++) ==> | |
| (let f = Foo ("inner:" ++) ==> foo . foo in f "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment