Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
GADT value for TOML.
Type of value
Needed for GADT parameterization
Instances
Eq TValue Source # | |
Read TValue Source # | |
Show TValue Source # | |
Generic TValue Source # | |
NFData TValue Source # | |
Defined in Toml.Type.Value | |
type Rep TValue Source # | |
Defined in Toml.Type.Value type Rep TValue = D1 (MetaData "TValue" "Toml.Type.Value" "tomland-1.0.0-inplace" False) (((C1 (MetaCons "TBool" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "TInteger" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "TDouble" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "TText" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "TZoned" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "TLocal" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "TDay" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "THours" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "TArray" PrefixI False) (U1 :: Type -> Type))))) |
Value
data Value (t :: TValue) where Source #
Value in key = value
pair.
Bool :: Bool -> Value TBool | Boolean value: bool1 = true bool2 = false |
Integer :: Integer -> Value TInteger | Integer value: int1 = +99 int2 = 42 int3 = 0 int4 = -17 int5 = 5_349_221 hex1 = 0xDEADBEEF # hexadecimal oct2 = 0o755 # octal, useful for Unix file permissions bin1 = 0b11010110 # binary |
Double :: Double -> Value TDouble | Floating point number: # fractional flt1 = +1.0 flt2 = 3.1415 flt3 = -0.01 # exponent flt4 = 5e+22 flt5 = 1e6 flt6 = -2E-2 # both flt7 = 6.626e-34 # infinity sf1 = inf # positive infinity sf2 = +inf # positive infinity sf3 = -inf # negative infinity # not a number sf4 = nan # actual sNaN/qNaN encoding is implementation specific sf5 = +nan # same as `nan` sf6 = -nan # same as `nan` |
Text :: Text -> Value TText | String value: # basic string name = "Orange" physical.color = "orange" physical.shape = "round" # multiline basic string str1 = """ Roses are red Violets are blue""" # literal string: What you see is what you get. winpath = 'C:\Users\nodejs\templates' winpath2 = '\\ServerX\admin$\system32\' quoted = 'Tom "Dubs" Preston-Werner' regex = '<\i\c*\s*>' |
Zoned :: ZonedTime -> Value TZoned | Offset date-time: odt1 = 1979-05-27T07:32:00Z odt2 = 1979-05-27T00:32:00-07:00 odt3 = 1979-05-27T00:32:00.999999-07:00 |
Local :: LocalTime -> Value TLocal | Local date-time (without offset): ldt1 = 1979-05-27T07:32:00 ldt2 = 1979-05-27T00:32:00.999999 |
Day :: Day -> Value TDay | Local date (only day): ld1 = 1979-05-27 |
Hours :: TimeOfDay -> Value THours | Local time (time of the day): lt1 = 07:32:00 lt2 = 00:32:00.999999 |
Array :: [Value t] -> Value TArray | Array of values. According to TOML specification all values in array should have the same type. This is guaranteed statically with this type. arr1 = [ 1, 2, 3 ] arr2 = [ "red", "yellow", "green" ] arr3 = [ [ 1, 2 ], [3, 4, 5] ] arr4 = [ "all", 'strings', """are the same""", '''type'''] arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] arr6 = [ 1, 2.0 ] # INVALID |
eqValueList :: [Value a] -> [Value b] -> Bool Source #
Compare list of Value
of possibly different types.
Type checking
data TypeMismatchError Source #
Data type that holds expected vs. actual type.
Instances
Eq TypeMismatchError Source # | |
Defined in Toml.Type.Value (==) :: TypeMismatchError -> TypeMismatchError -> Bool # (/=) :: TypeMismatchError -> TypeMismatchError -> Bool # | |
Show TypeMismatchError Source # | |
Defined in Toml.Type.Value showsPrec :: Int -> TypeMismatchError -> ShowS # show :: TypeMismatchError -> String # showList :: [TypeMismatchError] -> ShowS # |