Skip to content

Commit 86d5a49

Browse files
committed
Require hslua 2.3, tasty-lua 1.1
This adds typing information to fields, and links the Doc type to the module.
1 parent fab6ef1 commit 86d5a49

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

cabal.project

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: .

hslua-module-doclayout.cabal

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ source-repository head
3030
common common-options
3131
build-depends: base >= 4.11 && < 5
3232
, doclayout >= 0.2 && < 0.5
33-
, hslua >= 2.1 && < 2.3
33+
, hslua >= 2.3 && < 2.4
3434
, text >= 1.2 && < 2.1
3535

3636
default-language: Haskell2010
@@ -64,7 +64,7 @@ test-suite hslua-module-doclayout-test
6464
build-depends: hslua-module-doclayout
6565
, tasty
6666
, tasty-hunit
67-
, tasty-lua >= 1.0 && < 1.1
67+
, tasty-lua >= 1.1 && < 1.2
6868
type: exitcode-stdio-1.0
6969
hs-source-dirs: test
7070
main-is: test-hslua-module-doclayout.hs

src/HsLua/Module/DocLayout.hs

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{-# LANGUAGE CPP #-}
2-
{-# LANGUAGE FlexibleInstances #-}
3-
{-# LANGUAGE LambdaCase #-}
4-
{-# LANGUAGE OverloadedStrings #-}
5-
{-# LANGUAGE TypeApplications #-}
1+
{-# LANGUAGE FlexibleInstances #-}
2+
{-# LANGUAGE LambdaCase #-}
3+
{-# LANGUAGE OverloadedStrings #-}
4+
{-# LANGUAGE ScopedTypeVariables #-}
5+
{-# LANGUAGE TypeApplications #-}
66
{-# OPTIONS_GHC -fno-warn-orphans #-}
77
{-|
88
Module : HsLua.Module.DocLayout
@@ -78,10 +78,6 @@ import Text.DocLayout (Doc, (<+>), ($$), ($+$))
7878
import qualified Data.Text as T
7979
import qualified Text.DocLayout as Doc
8080

81-
#if ! MIN_VERSION_base(4, 11, 0)
82-
import Data.Monoid ((<>))
83-
#endif
84-
8581
--
8682
-- Module
8783
--
@@ -98,14 +94,15 @@ documentedModule = Module
9894
, moduleDescription = description
9995
, moduleFunctions = functions
10096
, moduleOperations = []
97+
, moduleTypeInitializers = [initType typeDoc]
10198
}
10299

103100
--
104101
-- Fields
105102
--
106103

107104
-- | Exposed fields.
108-
fields :: LuaError e => [Field e]
105+
fields :: forall e. LuaError e => [Field e]
109106
fields =
110107
[ blankline
111108
, cr
@@ -114,36 +111,40 @@ fields =
114111
]
115112

116113
-- | Wrapped and documented 'Doc.blankline' value.
117-
blankline :: LuaError e => Field e
114+
blankline :: forall e. LuaError e => Field e
118115
blankline = Field
119116
{ fieldName = "blankline"
120117
, fieldDescription = "Inserts a blank line unless one exists already."
118+
, fieldType = udTypeSpec @e typeDoc
121119
, fieldPushValue = pushDoc Doc.blankline
122120
}
123121

124122
-- | Wrapped and documented 'Doc.cr' value.
125-
cr :: LuaError e => Field e
123+
cr :: forall e. LuaError e => Field e
126124
cr = Field
127125
{ fieldName = "cr"
128126
, fieldDescription = "A carriage return. Does nothing if we're at " <>
129127
"the beginning of a line; " <>
130128
"otherwise inserts a newline."
129+
, fieldType = udTypeSpec @e typeDoc
131130
, fieldPushValue = pushDoc Doc.cr
132131
}
133132

134133
-- | Wrapped and documented 'Doc.empty' value.
135-
empty :: LuaError e => Field e
134+
empty :: forall e. LuaError e => Field e
136135
empty = Field
137136
{ fieldName = "empty"
138137
, fieldDescription = "The empty document."
138+
, fieldType = udTypeSpec @e typeDoc
139139
, fieldPushValue = pushDoc Doc.empty
140140
}
141141

142142
-- | Wrapped and documented 'Doc.space' value.
143-
space :: LuaError e => Field e
143+
space :: forall e. LuaError e => Field e
144144
space = Field
145145
{ fieldName = "space"
146146
, fieldDescription = "A breaking (reflowable) space."
147+
, fieldType = udTypeSpec @e typeDoc
147148
, fieldPushValue = pushDoc Doc.space
148149
}
149150

0 commit comments

Comments
 (0)