summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Infra/Ident.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-10-21 19:20:31 +0000
committerhallgren <hallgren@chalmers.se>2014-10-21 19:20:31 +0000
commit391b301881bee7de9580f2c6d819144161e6a51d (patch)
tree11e61e5252bfe6939eee9ef14d19bd7ca6c8bb40 /src/compiler/GF/Infra/Ident.hs
parent3bfcfa157dc291e03bfb4db3baed8b0098d76f50 (diff)
ModuleName and Ident are now distinct types
This makes the documentation clearer, and can potentially catch more programming mistakes.
Diffstat (limited to 'src/compiler/GF/Infra/Ident.hs')
-rw-r--r--src/compiler/GF/Infra/Ident.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/GF/Infra/Ident.hs b/src/compiler/GF/Infra/Ident.hs
index 71e86fb37..7d0bed804 100644
--- a/src/compiler/GF/Infra/Ident.hs
+++ b/src/compiler/GF/Infra/Ident.hs
@@ -13,6 +13,7 @@
-----------------------------------------------------------------------------
module GF.Infra.Ident (-- ** Identifiers
+ ModuleName(..), moduleNameS,
Ident, ident2utf8, showIdent, prefixIdent,
identS, identC, identV, identA, identAV, identW,
argIdent, isArgIdent, getArgIndex,
@@ -34,6 +35,15 @@ import PGF.Internal(Binary(..))
import GF.Text.Pretty
+-- | Module names
+newtype ModuleName = MN Ident deriving (Eq,Ord)
+
+moduleNameS = MN . identS
+
+instance Show ModuleName where showsPrec d (MN m) = showsPrec d m
+instance Pretty ModuleName where pp (MN m) = pp m
+
+
-- | the constructors labelled /INTERNAL/ are
-- internal representation never returned by the parser
data Ident =