Skip to content

Commit 7dbbd0e

Browse files
committed
Require hslua-2.5
1 parent 47a956f commit 7dbbd0e

File tree

2 files changed

+25
-36
lines changed

2 files changed

+25
-36
lines changed

hslua-module-doclayout.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ source-repository head
3131
common common-options
3232
build-depends: base >= 4.11 && < 5
3333
, doclayout >= 0.5 && < 0.6
34-
, hslua >= 2.3 && < 2.5
34+
, hslua >= 2.5 && < 2.6
3535
, text >= 1.2 && < 2.2
3636

3737
default-language: Haskell2010

src/HsLua/Module/DocLayout.hs

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{-# OPTIONS_GHC -fno-warn-orphans #-}
77
{-|
88
Module : HsLua.Module.DocLayout
9-
Copyright : © 2020-2024 Albert Krewinkel
9+
Copyright : © 2020-2026 Albert Krewinkel
1010
License : MIT
1111
Maintainer : Albert Krewinkel <[email protected]>
1212
@@ -97,14 +97,11 @@ description = "Plain-text document layouting."
9797

9898
-- | Self-documenting module.
9999
documentedModule :: LuaError e => Module e
100-
documentedModule = Module
101-
{ moduleName = "doclayout"
102-
, moduleFields = fields
103-
, moduleDescription = description
104-
, moduleFunctions = functions
105-
, moduleOperations = []
106-
, moduleTypeInitializers = [initType typeDoc]
107-
}
100+
documentedModule = defmodule "doclayout"
101+
`withFields` fields
102+
`withDescription` description
103+
`withFunctions` functions
104+
`associateType` typeDoc
108105

109106
--
110107
-- Fields
@@ -121,41 +118,33 @@ fields =
121118

122119
-- | Wrapped and documented 'Doc.blankline' value.
123120
blankline :: forall e. LuaError e => Field e
124-
blankline = Field
125-
{ fieldName = "blankline"
126-
, fieldDescription = "Inserts a blank line unless one exists already."
127-
, fieldType = udTypeSpec @e typeDoc
128-
, fieldPushValue = pushDoc Doc.blankline
129-
}
121+
blankline = deffield "blankline"
122+
`withDescription` "Inserts a blank line unless one exists already."
123+
`withType` udTypeSpec @e typeDoc
124+
`withValue` pushDoc Doc.blankline
130125

131126
-- | Wrapped and documented 'Doc.cr' value.
132127
cr :: forall e. LuaError e => Field e
133-
cr = Field
134-
{ fieldName = "cr"
135-
, fieldDescription = "A carriage return. Does nothing if we're at " <>
136-
"the beginning of a line; " <>
137-
"otherwise inserts a newline."
138-
, fieldType = udTypeSpec @e typeDoc
139-
, fieldPushValue = pushDoc Doc.cr
140-
}
128+
cr = deffield "cr"
129+
`withDescription`
130+
"A carriage return. Does nothing if we're at " <>
131+
"the beginning of a line; otherwise inserts a newline."
132+
`withType` udTypeSpec @e typeDoc
133+
`withValue` pushDoc Doc.cr
141134

142135
-- | Wrapped and documented 'Doc.empty' value.
143136
empty :: forall e. LuaError e => Field e
144-
empty = Field
145-
{ fieldName = "empty"
146-
, fieldDescription = "The empty document."
147-
, fieldType = udTypeSpec @e typeDoc
148-
, fieldPushValue = pushDoc Doc.empty
149-
}
137+
empty = deffield "empty"
138+
`withDescription` "The empty document."
139+
`withType` udTypeSpec @e typeDoc
140+
`withValue` pushDoc Doc.empty
150141

151142
-- | Wrapped and documented 'Doc.space' value.
152143
space :: forall e. LuaError e => Field e
153-
space = Field
154-
{ fieldName = "space"
155-
, fieldDescription = "A breaking (reflowable) space."
156-
, fieldType = udTypeSpec @e typeDoc
157-
, fieldPushValue = pushDoc Doc.space
158-
}
144+
space = deffield "space"
145+
`withDescription` "A breaking (reflowable) space."
146+
`withType` udTypeSpec @e typeDoc
147+
`withValue` pushDoc Doc.space
159148

160149
--
161150
-- Functions

0 commit comments

Comments
 (0)