Safe Haskell | None |
---|---|
Language | Haskell2010 |
Contains specification of TOML via Haskell ADT.
- data TOML = TOML {}
- data ValueType
- data Value (t :: ValueType) where
- data AnyValue = AnyValue (Value t)
- data UValue
- data DateTime
- matchBool :: Value f -> Maybe Bool
- matchInteger :: Value f -> Maybe Integer
- matchDouble :: Value f -> Maybe Double
- matchText :: Value f -> Maybe Text
- matchDate :: Value f -> Maybe DateTime
- matchArray :: (forall t. Value t -> Maybe a) -> Value f -> Maybe [a]
- showType :: ValueType -> String
- valueType :: Value t -> ValueType
- typeCheck :: UValue -> Either TypeMismatchError AnyValue
Main type
Represents TOML configuration value.
Values
Needed for GADT parameterization
data Value (t :: ValueType) where Source #
Value in key = value
pair.
Bool :: Bool -> Value TBool | Boolean value: bool1 = true bool2 = false |
Int :: Integer -> Value TInt | Integer value: int1 = +99 int2 = 42 int3 = 0 int4 = -17 int5 = 5_349_221 hex1 = 0xDEADBEEF oct2 = 0o755 # useful for Unix file permissions bin1 = 0b11010110 |
Float :: Double -> Value TFloat | Floating point number: flt1 = -3.1415 # fractional flt2 = 1e6 # exponent flt3 = 6.626e-34 # both flt4 = 9_224_617.445_991_228_313 |
String :: Text -> Value TString | String value: key = "value" bare_key = "value" bare-key = "value" |
Date :: DateTime -> Value TDate | Date-time. See documentation for |
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", |
Existential wrapper for Value
.
Zoned !ZonedTime | Offset date-time: odt1 = 1979-05-27T07:32:00Z odt2 = 1979-05-27T00:32:00-07:00 |
Local !LocalTime | Local date-time (without offset): ldt1 = 1979-05-27T07:32:00 ldt2 = 1979-05-27T00:32:00.999999 |
Day !Day | Local date (only day): ld1 = 1979-05-27 |
Hours !TimeOfDay | Local time (time of the day): lt1 = 07:32:00 lt2 = 00:32:00.999999 |
matchArray :: (forall t. Value t -> Maybe a) -> Value f -> Maybe [a] Source #
Extract list of elements of type a
from array.