Skip to content

Commit

Permalink
Fix old ghc
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Feb 21, 2024
1 parent 9b026e5 commit b4019a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ stateDiagram-v2
TOML:::important --> ApplicationTypes:::important : decode
ApplicationTypes --> TOML : encode
TOML --> [Token]: Toml.Syntax.Lexer
[Token] --> [Expr]: Toml.Syntax.Parser
[Expr] --> Table : Toml.Semantics
Table --> ApplicationTypes : Toml.FromValue
ApplicationTypes --> Table : Toml.ToValue
Table --> TOML : Toml.Pretty
TOML --> [Token]: Lexer
[Token] --> [Expr]: Parser
[Expr] --> Table : Semantics
Table --> ApplicationTypes : FromValue
ApplicationTypes --> Table : ToValue
Table --> TOML : Pretty
```

The highest-level interface to this package is to define `FromValue` and `ToTable`
instances for your application-specific datatypes. These can be used with `encode`
and `decode` to convert to and from TOML.
Most users will only need to import **Toml** or **Toml.Schema**. Other top-level
modules are for low-level hacking on the TOML format itself. All modules below
these top-level modules are exposed to provide direct access to library implementation
details.

For low-level access to the TOML format, the lexer, parser, and validator are available
for direct use. The diagram above shows how the different modules enable you to
advance through the increasingly high-level TOML representations.
- **Toml** - Basic encoding and decoding TOML
- **Toml.Schema** - TOML schemas for application types
- **Toml.Semantics** - Low-level semantic operations on TOML syntax
- **Toml.Syntax** - Low-level parsing of text into TOML raw syntax

## Examples

Expand Down
4 changes: 2 additions & 2 deletions src/Toml/Schema/FromValue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module Toml.Schema.FromValue (

) where

import Control.Monad (zipWithM)
import Control.Monad (zipWithM, liftM2)
import Data.Int (Int8, Int16, Int32, Int64)
import Data.List.NonEmpty (NonEmpty)
import Data.List.NonEmpty qualified as NonEmpty
Expand Down Expand Up @@ -71,7 +71,7 @@ mapOf matchKey matchVal =
\case
Table' _ (MkTable t) -> Map.fromList <$> sequence kvs
where
kvs = [liftA2 (,) (matchKey l k) (inKey k (matchVal k v)) | (k, (l, v)) <- Map.assocs t]
kvs = [liftM2 (,) (matchKey l k) (inKey k (matchVal k v)) | (k, (l, v)) <- Map.assocs t]
v -> typeError "table" v

-- | List matching function used to help implemented 'fromValue' for arrays.
Expand Down

0 comments on commit b4019a0

Please sign in to comment.