Skip to content

Commit 2b6df61

Browse files
Make KDL a top-level module
1 parent 7ef6fed commit 2b6df61

24 files changed

Lines changed: 161 additions & 161 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ package {
2424
Parse it with `kdl-hs`:
2525

2626
```hs
27-
import Data.KDL qualified as KDL
27+
import KDL qualified as KDL
2828

2929
main :: IO ()
3030
main = do

kdl-hs.cabal

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ source-repository head
2323
library
2424
hs-source-dirs: src
2525
exposed-modules:
26-
Data.KDL
27-
Data.KDL.Arrow
28-
Data.KDL.Decoder
29-
Data.KDL.Decoder.Arrow
30-
Data.KDL.Decoder.Internal.DecodeM
31-
Data.KDL.Decoder.Internal.Error
32-
Data.KDL.Decoder.Internal.Monad
33-
Data.KDL.Decoder.Monad
34-
Data.KDL.Decoder.Schema
35-
Data.KDL.Parser
36-
Data.KDL.Render
37-
Data.KDL.Types
26+
KDL
27+
KDL.Arrow
28+
KDL.Decoder
29+
KDL.Decoder.Arrow
30+
KDL.Decoder.Internal.DecodeM
31+
KDL.Decoder.Internal.Error
32+
KDL.Decoder.Internal.Monad
33+
KDL.Decoder.Monad
34+
KDL.Decoder.Schema
35+
KDL.Parser
36+
KDL.Render
37+
KDL.Types
3838
other-modules:
39-
Data.KDL.Parser.Hustle
40-
Data.KDL.Parser.Hustle.Formatter
41-
Data.KDL.Parser.Hustle.Internal
42-
Data.KDL.Parser.Hustle.Parser
43-
Data.KDL.Parser.Hustle.Types
39+
KDL.Parser.Hustle
40+
KDL.Parser.Hustle.Formatter
41+
KDL.Parser.Hustle.Internal
42+
KDL.Parser.Hustle.Parser
43+
KDL.Parser.Hustle.Types
4444
build-depends:
4545
base < 5
4646
, containers
@@ -59,9 +59,9 @@ test-suite kdl-tests
5959
hs-source-dirs: test
6060
main-is: Main.hs
6161
other-modules:
62-
Data.KDL.ParserSpec
63-
Data.KDL.Decoder.ArrowSpec
64-
Data.KDL.Decoder.MonadSpec
62+
KDL.ParserSpec
63+
KDL.Decoder.ArrowSpec
64+
KDL.Decoder.MonadSpec
6565
build-depends:
6666
base
6767
, containers

src/Data/KDL/Decoder.hs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Data/KDL/Decoder/Monad.hs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Data/KDL.hs renamed to src/KDL.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{-|
22
This module is intended to be imported qualified as:
33
4-
> import Data.KDL qualified as KDL
4+
> import KDL qualified as KDL
55
66
This provides a Monad interface for decoding KDL files, which is sufficient for
7-
most cases. You may wish to use "Data.KDL.Arrow" if you would like to
7+
most cases. You may wish to use "KDL.Arrow" if you would like to
88
statically analyze a decoder's schema, e.g. to generate documentation.
99
1010
= Quickstart
@@ -26,7 +26,7 @@ package {
2626
Parse it with @kdl-hs@:
2727
2828
@
29-
import Data.KDL qualified as KDL
29+
import KDL qualified as KDL
3030
3131
main :: IO ()
3232
main = do
@@ -64,11 +64,11 @@ instance KDL.DecodeNode Dep where
6464
pure Dep{..}
6565
@
6666
-}
67-
module Data.KDL (
67+
module KDL (
6868
module X,
6969
) where
7070

71-
import Data.KDL.Decoder as X
72-
import Data.KDL.Parser as X
73-
import Data.KDL.Render as X
74-
import Data.KDL.Types as X
71+
import KDL.Decoder as X
72+
import KDL.Parser as X
73+
import KDL.Render as X
74+
import KDL.Types as X
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
This module defines the Arrow interface for decoding a KDL document. Intended to
33
be imported qualified as:
44
5-
> import Data.KDL.Arrow qualified as KDL
5+
> import KDL.Arrow qualified as KDL
66
7-
For most use-cases, the Monad interface exported by "Data.KDL" is sufficient. You
7+
For most use-cases, the Monad interface exported by "KDL" is sufficient. You
88
may wish to use the Arrow interface if you would like to statically analyze a
99
decoder's schema, e.g. to generate documentation.
1010
@@ -29,7 +29,7 @@ Parse it with:
2929
@
3030
{\-# LANGUAGE Arrows #-\}
3131
32-
import Data.KDL.Decoder.Arrow qualified as KDL
32+
import KDL.Decoder.Arrow qualified as KDL
3333
3434
main :: IO ()
3535
main = do
@@ -67,12 +67,12 @@ instance KDL.DecodeNode Dep where
6767
returnA -< Dep{..}
6868
@
6969
-}
70-
module Data.KDL.Arrow (
70+
module KDL.Arrow (
7171
module X,
7272
) where
7373

74-
import Data.KDL.Decoder.Arrow as X
75-
import Data.KDL.Decoder.Schema as X
76-
import Data.KDL.Parser as X
77-
import Data.KDL.Render as X
78-
import Data.KDL.Types as X
74+
import KDL.Decoder.Arrow as X
75+
import KDL.Decoder.Schema as X
76+
import KDL.Parser as X
77+
import KDL.Render as X
78+
import KDL.Types as X

src/KDL/Decoder.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module KDL.Decoder (
2+
-- * Decoder monad
3+
module KDL.Decoder.Monad,
4+
5+
-- * Schema
6+
module KDL.Decoder.Schema,
7+
) where
8+
9+
import KDL.Decoder.Monad
10+
import KDL.Decoder.Schema
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
{-# LANGUAGE OverloadedStrings #-}
66
{-# LANGUAGE TypeFamilies #-}
77

8-
module Data.KDL.Decoder.Arrow (
8+
module KDL.Decoder.Arrow (
99
decodeWith,
1010
decodeFileWith,
1111
decodeDocWith,
1212

1313
-- * Decoder
1414
Decoder,
15-
module Data.KDL.Decoder.Internal.DecodeM,
15+
module KDL.Decoder.Internal.DecodeM,
1616
fail,
1717
withDecoder,
1818
debug,
@@ -91,17 +91,31 @@ import Control.Monad.Trans.State.Strict (StateT)
9191
import Control.Monad.Trans.State.Strict qualified as StateT
9292
import Data.Bits (finiteBitSize)
9393
import Data.Int (Int64)
94-
import Data.KDL.Decoder.Internal.DecodeM
95-
import Data.KDL.Decoder.Internal.Monad
96-
import Data.KDL.Decoder.Schema (
94+
import Data.List (partition)
95+
import Data.List.NonEmpty qualified as NonEmpty
96+
import Data.Map.Strict (Map)
97+
import Data.Map.Strict qualified as Map
98+
import Data.Maybe (fromMaybe, isNothing)
99+
import Data.Proxy (Proxy (..))
100+
import Data.Scientific (Scientific)
101+
import Data.Scientific qualified as Scientific
102+
import Data.Set qualified as Set
103+
import Data.Text (Text)
104+
import Data.Text qualified as Text
105+
import Data.Typeable (Typeable, typeRep)
106+
import Data.Word (Word16, Word32, Word64, Word8)
107+
import GHC.Int (Int16, Int32, Int8)
108+
import KDL.Decoder.Internal.DecodeM
109+
import KDL.Decoder.Internal.Monad
110+
import KDL.Decoder.Schema (
97111
Schema (..),
98112
SchemaItem (..),
99113
SchemaOf,
100114
TypedNodeSchema (..),
101115
TypedValueSchema (..),
102116
)
103-
import Data.KDL.Parser (parse, parseFile)
104-
import Data.KDL.Types (
117+
import KDL.Parser (parse, parseFile)
118+
import KDL.Types (
105119
Ann (..),
106120
Document,
107121
Entry (..),
@@ -111,20 +125,6 @@ import Data.KDL.Types (
111125
Value (..),
112126
ValueData (..),
113127
)
114-
import Data.List (partition)
115-
import Data.List.NonEmpty qualified as NonEmpty
116-
import Data.Map.Strict (Map)
117-
import Data.Map.Strict qualified as Map
118-
import Data.Maybe (fromMaybe, isNothing)
119-
import Data.Proxy (Proxy (..))
120-
import Data.Scientific (Scientific)
121-
import Data.Scientific qualified as Scientific
122-
import Data.Set qualified as Set
123-
import Data.Text (Text)
124-
import Data.Text qualified as Text
125-
import Data.Typeable (Typeable, typeRep)
126-
import Data.Word (Word16, Word32, Word64, Word8)
127-
import GHC.Int (Int16, Int32, Int8)
128128
import Numeric.Natural (Natural)
129129
import Prelude hiding (any, fail, null)
130130
import Prelude qualified
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
{-# LANGUAGE RecordWildCards #-}
55
{-# LANGUAGE NoFieldSelectors #-}
66

7-
module Data.KDL.Decoder.Internal.DecodeM (
7+
module KDL.Decoder.Internal.DecodeM (
88
-- * Decoding errors
9-
module Data.KDL.Decoder.Internal.Error,
9+
module KDL.Decoder.Internal.Error,
1010

1111
-- * DecodeM monad
1212
DecodeM (..),
@@ -19,8 +19,8 @@ module Data.KDL.Decoder.Internal.DecodeM (
1919
) where
2020

2121
import Control.Applicative (Alternative (..))
22-
import Data.KDL.Decoder.Internal.Error
2322
import Data.Text (Text)
23+
import KDL.Decoder.Internal.Error
2424

2525
-- | The monad that returns either a 'DecodeError' or a result of type @a@.
2626
--
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44
{-# LANGUAGE RecordWildCards #-}
55
{-# LANGUAGE NoFieldSelectors #-}
66

7-
module Data.KDL.Decoder.Internal.Error (
7+
module KDL.Decoder.Internal.Error (
88
DecodeError (..),
99
BaseDecodeError (..),
1010
Context,
1111
ContextItem (..),
1212
renderDecodeError,
1313
) where
1414

15-
import Data.KDL.Render (
15+
import Data.Map qualified as Map
16+
import Data.Text (Text)
17+
import Data.Text qualified as Text
18+
import KDL.Render (
1619
renderIdentifier,
1720
renderValue,
1821
)
19-
import Data.KDL.Types (
22+
import KDL.Types (
2023
Identifier,
2124
Value,
2225
)
23-
import Data.Map qualified as Map
24-
import Data.Text (Text)
25-
import Data.Text qualified as Text
2626

2727
data DecodeError = DecodeError [(Context, BaseDecodeError)]
2828
deriving (Show, Eq)

0 commit comments

Comments
 (0)