Permalink
Browse files

Add `-` as a valid identifier character

Part of #31, requested by @scott-fleischman

You can now use `-` in identifier names for all but the first character.
That means that this is now legal code:

```
{ resolver = "lts-8.1", extra-deps = [ "pipes-4.3.1" ] }
```

This primarily serves people who want to use "kebab-case" for their
identifier names

Normally languages do not support dash in identifier names due to
ambiguity with the subtraction operator.  For example, an identifier
like `extra-deps` could be interpreted as `extra` minus `deps`.
However, Dhall does not support subtraction and only supports unary
negation so there is no ambiguity.
  • Loading branch information...
Gabriel439 committed Apr 30, 2017
1 parent f6b8694 commit aeb7d165251a0612538e0ca8f84d60b5aaac6c8d
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/Dhall/Parser.hs
View
@@ -113,7 +113,7 @@ identifierStyle = IdentifierStyle
, _styleStart =
Text.Parser.Char.oneOf (['A'..'Z'] ++ ['a'..'z'] ++ "_")
, _styleLetter =
Text.Parser.Char.oneOf (['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "_/")
Text.Parser.Char.oneOf (['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "_-/")
, _styleReserved = Data.HashSet.fromList
[ "let"
, "in"

0 comments on commit aeb7d16

Please sign in to comment.