Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module contains types, definitions, and the logic behind finding persistent definitions.
In brief, we do an import of all the models defined in the current
directory or any subdirectories. These imports are "instances only"
imports. Then we splice in $(discoverEntities)
to
The result module is named All
, and it's placed in the hierarchy where
you define this. So if you have a source file:
-- srcPersistentModelsAll.hs {-# OPTIONS_GHC -F -pgmF persistent-discover
Then it will translate to:
-- srcPersistentModelsAll.hs module PersistentModels.All where import PersistentModels.Foo () import PersistentModels.Bar () import PersistentModels.Baz () allEntityDefs :: [EntityDef] allEntityDefs = $(discoverEntities)
Since: 0.1.0.0
Synopsis
- newtype Source = Source FilePath
- newtype Destination = Destination FilePath
- data AllModelsFile = AllModelsFile {}
- render :: Render -> String
- renderLine :: Render -> Render
- newtype Render' a = Render {}
- type Render = Render' ()
- indent :: Int -> Render -> Render
- discoverModels :: Source -> Destination -> IO ()
- getFilesRecursive :: FilePath -> IO [FilePath]
- renderFile :: AllModelsFile -> String
- data Module = Module {}
- mkModulePieces :: FilePath -> [String]
- isLowerFirst :: String -> Bool
- pathToModule :: FilePath -> Maybe Module
- isValidModuleName :: String -> Bool
- isValidModuleChar :: Char -> Bool
- casify :: String -> String
- stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
Documentation
newtype Destination Source #
data AllModelsFile Source #
renderLine :: Render -> Render Source #
discoverModels :: Source -> Destination -> IO () Source #
Since: 0.1.0.0
Returns a list of relative paths to all files in the given directory.
renderFile :: AllModelsFile -> String Source #
Module | |
|
mkModulePieces :: FilePath -> [String] Source #
isLowerFirst :: String -> Bool Source #
isValidModuleName :: String -> Bool Source #
Returns True if the given string is a valid task module name.
See ModuleName
(http:/git.iobj34)
isValidModuleChar :: Char -> Bool Source #
Returns True if the given Char is a valid taks module character.
stripSuffix :: Eq a => [a] -> [a] -> Maybe [a] Source #