, IsExprSet
, IsCommonExprSet
- , Constant(..)
, IsVarName
+ , IsShortEnoughForVarName
+ , IsGoodLetterForVarName
+
+ , Constant(..)
, Variable(..)
, IsVariableSet
, CommonUnaryOp(..)
import Data.HList
import Data.HList.String
+import Types.Data.Bool
+import Types.Data.Num hiding ((:*:))
+import Types.Data.Ord
-- MentionedVars
type MentionedVarsOf Constant = HNil
{- This is what we want to do but GHC can't handle this for now.
-class ( (HLengthOf a :<=: D255) ~ True
- , HString a
+class ( (HLengthOf str :<=: D255) ~ True
+ , HString str
)
- => IsVarName a
+ => IsVarName str
-}
-class HString a => IsVarName a
+class ( IsShortEnoughForVarName str
+ , HString str
+ )
+ => IsVarName str
+
+class HString str => IsShortEnoughForVarName str
+instance ( HString str
+ , (HLength str :<=: D255) ~ True
+ )
+ => IsShortEnoughForVarName str
+
+class IntegerT c => GoodLetterForVarName c where
+ type IsGoodLetterForVarName c
+
+instance IntegerT c => GoodLetterForVarName c where
+ type IsGoodLetterForVarName c = ( (c :>=: D65) :&&: (c :<=: D90) ) -- A-Z
+ :||:
+ ( (c :>=: D99) :&&: (c :<=: D122) ) -- a-z
+ :||:
+ ( c :==: D45 ) -- '-'
+ :||:
+ ( c :==: D95 ) -- '_'
+
+--instance (a :>=: D65) ~ True => IsGoodLetterForVarName a
+-- Variable
data Variable vn
= Variable !vn
deriving (Show, Eq, Ord)