-
Notifications
You must be signed in to change notification settings - Fork 21
Move to typed quotes #9
base: master
Are you sure you want to change the base?
Conversation
This allows the splices provided by `gitrev` to be included in typed TH quotes. Moreover, they greatly clarify the interfaces. This change should of course be accompanied by a major version bump.
Sorry for the delay on this; a mail filter gone awry hid messages about this repo from me for months. Are the typed TH splices documented anywhere? This is the first I've seen them, and only the syntax appears to be described in the user's guide. Will this break compatibility with older GHCs? |
Sadly the documentation for typed quotes is a bit lacking. Typed quotes were introduced around 2013. I believe the first GHC release which it appeared in was 7.8.1. So I suppose the answer is yes, this will have implications on older GHCs. |
"Adam C. Foltzer" <[email protected]> writes:
Sorry for the delay on this; a mail filter gone awry hid messages about this repo from me for months.
Are the typed TH splices documented anywhere?
Sadly there is relatively little discussion in the users guide.
Moreover, it all seems to be hidden away in
https://downloads.haskell.org/~ghc/master/users-guide//glasgow_exts.html#th-syntax
This is the first I've seen them, and only the syntax appears to be
described in the user's guide. Will this break compatibility with
older GHCs?
Typed splices were introduced in GHC 7.8. In general I quite like typed
splices as they eliminate much of the fragility associated with TH, but
I can understand if this is too much breakage to endure for a relatively
modest improvement in safety.
|
gitDirty = do | ||
output <- runGit ["status", "--porcelain"] "" IdxUsed | ||
case output of | ||
"" -> conE falseName | ||
_ -> conE trueName | ||
"" -> boolT False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just be [|| False ||]
|
||
-- | Return the branch (or tag) name of the current git commit, or @UNKNOWN@ | ||
-- if not in a git repository. For detached heads, this will just be | ||
-- "HEAD" | ||
gitBranch :: ExpQ | ||
gitBranch :: Q (TExp String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TExpQ String
is another alias
This allows the splices provided by
gitrev
to be included in typedTH quotes. Moreover, they greatly clarify the interfaces.
This change should of course be accompanied by a major version bump.