Created
April 6, 2017 00:03
-
-
Save cartazio/8f9f33e58ac92f3fbf0e45b1cbb42dc5 to your computer and use it in GitHub Desktop.
how to do splices
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
$ ghci | |
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help | |
Prelude> :set -XQuasiQuotes | |
Prelude> :set -XTemplateHaskellQuotes | |
Prelude> [t| forall x . (x -> x) -> x |] | |
<interactive>:3:14: error: | |
Illegal symbol '.' in type | |
Perhaps you intended to use RankNTypes or a similar language | |
extension to enable explicit-forall syntax: forall <tvs>. <type> | |
Prelude> [t| forall x . (x -> x) -> x |] | |
Prelude> :set -XR | |
-XRank2Types -XRankNTypes -XRebindableSyntax -XRecordWildCards -XRecursiveDo -XRelaxedLayout -XRoleAnnotations | |
Prelude> :set -XRank | |
-XRank2Types -XRankNTypes | |
Prelude> :set -XRankNTypes | |
Prelude> [t| forall x . (x -> x) -> x |] | |
<interactive>:5:1: error: | |
• No instance for (Show Language.Haskell.TH.Lib.TypeQ) | |
arising from a use of ‘print’ | |
• In a stmt of an interactive GHCi command: print it | |
Prelude> [t| forall x . (x -> x) -> x |] | |
Prelude> import Language.Haskell.TH.Syntax | |
Prelude Language.Haskell.TH.Syntax> runQ $ t| forall x . (x -> x) -> x |] | |
<interactive>:7:31: error: parse error on input ‘->’ | |
Prelude Language.Haskell.TH.Syntax> runQ $ t| forall x . ((x -> x) -> x) |] | |
<interactive>:8:38: error: parse error on input ‘|]’ | |
Prelude Language.Haskell.TH.Syntax> runQ $ [t| forall x . ((x -> x) -> x) |] | |
ForallT [PlainTV x_0] [] (AppT (AppT ArrowT (AppT (AppT ArrowT (VarT x_0)) (VarT x_0))) (VarT x_0)) | |
Prelude Language.Haskell.TH.Syntax> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://hackage.haskell.org/package/template-haskell-2.11.1.0/docs/Language-Haskell-TH-Syntax.html#t:Quasi
and
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html?highlight=quasi#ghc-flag--XTemplateHaskell
are helpful links