Copyright | (c) Eric Mertens 2023 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides the type for the semantics of a TOML file. All dotted keys are resolved in this representation. Each table is a Map with a single level of keys.
Values are parameterized over an annotation type to allow values
to be attributed to a file location. When values are constructed
programmatically, there might not be any interesting annotations.
In this case a trivial ()
unit annotation can be used. The
Value
type-synonym and related pattern synonyms can make using
this case more convenient.
Synopsis
- type Value = Value' ()
- type Table = Table' ()
- data Value' a where
- Integer' a Integer
- Double' a Double
- List' a [Value' a]
- Table' a (Table' a)
- Bool' a Bool
- Text' a Text
- TimeOfDay' a TimeOfDay
- ZonedTime' a ZonedTime
- LocalTime' a LocalTime
- Day' a Day
- pattern Integer :: Integer -> Value
- pattern Double :: Double -> Value
- pattern Text :: Text -> Value
- pattern Bool :: Bool -> Value
- pattern ZonedTime :: ZonedTime -> Value
- pattern Day :: Day -> Value
- pattern LocalTime :: LocalTime -> Value
- pattern TimeOfDay :: TimeOfDay -> Value
- pattern List :: [Value] -> Value
- pattern Table :: Table -> Value
- newtype Table' a = MkTable (Map Text (a, Value' a))
- forgetValueAnns :: Value' a -> Value
- forgetTableAnns :: Table' a -> Table
- valueAnn :: Value' a -> a
- valueType :: Value' l -> String
Unlocated value synonyms
Annotated values
Semantic TOML value with all table assignments resolved.
Integer' a Integer | |
Double' a Double | |
List' a [Value' a] | |
Table' a (Table' a) | |
Bool' a Bool | |
Text' a Text | |
TimeOfDay' a TimeOfDay | |
ZonedTime' a ZonedTime | |
LocalTime' a LocalTime | |
Day' a Day |
pattern Integer :: Integer -> Value | |
pattern Double :: Double -> Value | |
pattern Text :: Text -> Value | |
pattern Bool :: Bool -> Value | |
pattern ZonedTime :: ZonedTime -> Value | |
pattern Day :: Day -> Value | |
pattern LocalTime :: LocalTime -> Value | |
pattern TimeOfDay :: TimeOfDay -> Value | |
pattern List :: [Value] -> Value | |
pattern Table :: Table -> Value |
Instances
Foldable Value' Source # | Derived |
Defined in Toml.Semantics.Types fold :: Monoid m => Value' m -> m # foldMap :: Monoid m => (a -> m) -> Value' a -> m # foldMap' :: Monoid m => (a -> m) -> Value' a -> m # foldr :: (a -> b -> b) -> b -> Value' a -> b # foldr' :: (a -> b -> b) -> b -> Value' a -> b # foldl :: (b -> a -> b) -> b -> Value' a -> b # foldl' :: (b -> a -> b) -> b -> Value' a -> b # foldr1 :: (a -> a -> a) -> Value' a -> a # foldl1 :: (a -> a -> a) -> Value' a -> a # elem :: Eq a => a -> Value' a -> Bool # maximum :: Ord a => Value' a -> a # minimum :: Ord a => Value' a -> a # | |
Traversable Value' Source # | Derived |
Functor Value' Source # | Derived |
FromValue Value Source # | Matches all values, used for pass-through |
ToValue Value Source # | Identity function |
() ~ a => IsString (Value' a) Source # | Constructs a TOML string literal. fromString = String |
Defined in Toml.Semantics.Types fromString :: String -> Value' a # | |
Read a => Read (Value' a) Source # | Default instance |
Show a => Show (Value' a) Source # | Default instance |
Eq a => Eq (Value' a) Source # | Nearly default instance except |
A table with annotated keys and values.
Instances
Foldable Table' Source # | Derived |
Defined in Toml.Semantics.Types fold :: Monoid m => Table' m -> m # foldMap :: Monoid m => (a -> m) -> Table' a -> m # foldMap' :: Monoid m => (a -> m) -> Table' a -> m # foldr :: (a -> b -> b) -> b -> Table' a -> b # foldr' :: (a -> b -> b) -> b -> Table' a -> b # foldl :: (b -> a -> b) -> b -> Table' a -> b # foldl' :: (b -> a -> b) -> b -> Table' a -> b # foldr1 :: (a -> a -> a) -> Table' a -> a # foldl1 :: (a -> a -> a) -> Table' a -> a # elem :: Eq a => a -> Table' a -> Bool # maximum :: Ord a => Table' a -> a # minimum :: Ord a => Table' a -> a # | |
Traversable Table' Source # | Derived |
Functor Table' Source # | Derived |
FromValue Table Source # | |
Read a => Read (Table' a) Source # | Default instance |
Show a => Show (Table' a) Source # | Default instance |
Eq a => Eq (Table' a) Source # | Default instance |
ToTable (Table' a) Source # | |
ToValue (Table' a) Source # | |
Utilities
forgetValueAnns :: Value' a -> Value Source #
Replaces annotations with a unit.
forgetTableAnns :: Table' a -> Table Source #
Replaces annotations with a unit.