BNFC-2.9.4.1: A compiler front-end generator.
Safe HaskellNone
LanguageHaskell2010

BNFC.Backend.Haskell.HsOpts

Synopsis

Documentation

mkMod :: (Options -> String -> String) -> String -> Options -> String Source #

>>> mkMod withLang "Abstract" defaultOptions { lang = "abc" }
"AbstractAbc"
>>> mkMod noLang "Abstract" defaultOptions { lang = "abc" }
"Abstract"
>>> mkMod withLang "Abstract" defaultOptions { lang = "abc", inPackage = Just "A.B.C" }
"A.B.C.AbstractAbc"
>>> mkMod withLang "Abstract" defaultOptions { lang = "abc", inDir = True }
"Abc.Abstract"
>>> mkMod withLang "Abstract" defaultOptions { lang = "abc", inDir = True, inPackage = Just "A.B.C" }
"A.B.C.Abc.Abstract"

mkFile :: (Options -> String -> String) -> String -> String -> Options -> FilePath Source #

>>> mkFile withLang "Abstract" "hs" defaultOptions { lang = "abc" }
"AbstractAbc.hs"
>>> mkFile noLang "Abstract" "hs" defaultOptions { lang = "abc" }
"Abstract.hs"
>>> mkFile withLang "Abstract" "" defaultOptions { lang = "abc" }
"AbstractAbc"
>>> mkFile noLang "Abstract" "" defaultOptions { lang = "abc" }
"Abstract"
>>> mkFile withLang "Abstract" "hs" defaultOptions { lang = "abc", inDir = True }
"Abc/Abstract.hs"
>>> mkFile withLang "Abstract" "hs" defaultOptions { lang = "abc", inDir = True, inPackage = Just "A.B.C" }
"A/B/C/Abc/Abstract.hs"

mkNamespace :: Options -> FilePath Source #

Determine the modules' namespace

>>> mkNamespace defaultOptions
""
>>> mkNamespace defaultOptions { lang = "Bla", inDir = True }
"Bla"
>>> mkNamespace defaultOptions { inPackage = Just "My.Cool.Package" }
"My.Cool.Package"
>>> mkNamespace defaultOptions { lang = "bla_bla", inDir = True }
"BlaBla"
>>> mkNamespace defaultOptions { lang = "bla", inDir = True, inPackage = Just "P"}
"P.Bla"

codeDir :: Options -> FilePath Source #

Determine the directory corresponding to the modules' namespace

>>> codeDir defaultOptions
""
>>> codeDir defaultOptions { lang = "Bla", inDir = True }
"Bla"
>>> codeDir defaultOptions { inPackage = Just "My.Cool.Package" }
"My/Cool/Package"
>>> codeDir defaultOptions { lang = "bla_bla", inDir = True }
"BlaBla"
>>> codeDir defaultOptions { lang = "bla", inDir = True, inPackage = Just "P"}
"P/Bla"