66{-# OPTIONS_GHC -fno-warn-orphans #-}
77{-|
88Module : HsLua.Module.DocLayout
9- Copyright : © 2020-2024 Albert Krewinkel
9+ Copyright : © 2020-2026 Albert Krewinkel
1010License : MIT
1111Maintainer : Albert Krewinkel <[email protected] > 1212
@@ -97,14 +97,11 @@ description = "Plain-text document layouting."
9797
9898-- | Self-documenting module.
9999documentedModule :: 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.
123120blankline :: 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.
132127cr :: 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.
143136empty :: 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.
152143space :: 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