Skip to content

Commit

Permalink
Resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mdgriffith committed Aug 25, 2024
2 parents 864f9ca + 2109064 commit d71cd79
Showing 1 changed file with 16 additions and 31 deletions.
47 changes: 16 additions & 31 deletions src/Elm/Declare.elm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Elm.Declare exposing
( Function, fn, fn2, fn3, fn4, fn5, fn6
, withDocumentation
, fnBuilder, fnArg, fnDone, fnBody, placeholder
, Value, value
, function
, Module, module_, with, withUnexposed
, withDocs, withTitle
, Annotation, alias, customType
, toFile, include, withSubmodule
, customTypeAdvanced, CustomType
Expand Down Expand Up @@ -44,6 +44,8 @@ Here's an example, let's define a new function called `add42`
@docs Function, fn, fn2, fn3, fn4, fn5, fn6
@docs withDocumentation
@docs fnBuilder, fnArg, fnDone, fnBody, placeholder
@docs Value, value
Expand Down Expand Up @@ -90,7 +92,7 @@ First, we can generate the Elm code for the module:
Or we can include it in another module:
Elm.file [ "MyInternalFile" ]
[ Elm.include { title = "", docs = "" } myModule
[ Elm.include myModule
--... Whatever other declarations you want in this file.
]
Expand All @@ -107,8 +109,6 @@ And handle the imports and everything.
@docs Module, module_, with, withUnexposed
@docs withDocs, withTitle
@docs Annotation, alias, customType
@docs toFile, include, withSubmodule
Expand Down Expand Up @@ -181,8 +181,6 @@ import Internal.Index as Index
{-| -}
type alias Module val =
{ name : List String
, title : String
, docs : String
, declarations : List Elm.Declaration
, call : val
}
Expand Down Expand Up @@ -238,8 +236,6 @@ type Internal val
module_ : List String -> val -> Module val
module_ name call =
{ name = name
, title = ""
, docs = ""
, call = call
, declarations = []
}
Expand Down Expand Up @@ -510,25 +506,6 @@ customVariant name types branch arg make (CustomTypeBuilder custom) =
}


{-| Add a module-level title to the module.
This will be rendered as a markdown header.
-}
withTitle : String -> Module val -> Module val
withTitle title mod =
{ mod | title = title }


{-| Add some markdown as a module-level documentation comment.
-}
withDocs : String -> Module val -> Module val
withDocs docs mod =
{ mod
| docs = mod.docs ++ docs
}


{-| -}
with :
{ a
Expand All @@ -543,8 +520,6 @@ with decl mod =
decl.internal
in
{ name = mod.name
, title = mod.title
, docs = mod.docs
, declarations = Elm.expose decl.declaration :: mod.declarations
, call = mod.call (call mod.name)
}
Expand Down Expand Up @@ -844,8 +819,6 @@ The only thing to be aware of here is that the module name for both of these mod
withSubmodule : Module submod -> Module (submod -> mod) -> Module mod
withSubmodule submod mod =
{ name = mod.name
, title = mod.title
, docs = mod.docs
, declarations = mod.declarations ++ [ include submod ]
, call = mod.call submod.call
}
Expand All @@ -859,3 +832,15 @@ withSubmodule submod mod =
include : Module val -> Elm.Declaration
include mod =
Compiler.Group mod.declarations


{-| Add documentation to a function or value declared using this module.
-}
withDocumentation :
String
-> { a | declaration : Elm.Declaration }
-> { a | declaration : Elm.Declaration }
withDocumentation doc val =
{ val
| declaration = val.declaration |> Elm.withDocumentation doc
}

0 comments on commit d71cd79

Please sign in to comment.