-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Load JSON from files in a directory structure -- -- Load JSON from files in a directory structure. The object created -- mirrors the directory structure, using filenames as keys. Useful for -- breaking apart large JSON structures. @package json-directory @version 0.1.0.2 module Data.JSON.Directory -- | Takes a directory and decodes it using a FromJSON -- instance. Each entry in the directory becomes a key, and the contents -- become the corresponding value. -- -- -- -- This function can throw IO exceptions as well as a -- ModifiedWhileReading exception if the modification -- time changes during processing. -- -- Uses defaultRules decodeDirectory :: (FromJSON a, MonadIO io) => FilePath -> io (Either String a) -- | Like decodeDirectory but you get to specify the rules. decodeDirectory' :: (FromJSON a, MonadIO io) => [Rule] -> FilePath -> io (Either String a) -- | How to interpret a file. data Rule Rule :: (FilePath -> Bool) -> (FilePath -> Key) -> (FilePath -> IO (IResult Value)) -> Rule -- | A predicate to see if this rule applies. [predicate] :: Rule -> FilePath -> Bool -- | A function to transform the filename into a JSON key value [jsonKey] :: Rule -> FilePath -> Key -- | Turn a file into a Value. The JSONPath in the -- IResult will be merged into the correct location. [parser] :: Rule -> FilePath -> IO (IResult Value) -- | The internal result of running a Parser. data IResult a IError :: JSONPath -> String -> IResult a ISuccess :: a -> IResult a -- | Some sane default rules. Attempts do do jsonRule and -- falls back to textRule defaultRules :: [Rule] -- | A rule that reads .json files as JSON. jsonRule :: Rule -- | A rule that reads any file into a JSON string. textRule :: Rule idecodeStrict :: FromJSON a => ByteString -> IResult a data ModifiedWhileReading data NoRuleFor instance GHC.Show.Show Data.JSON.Directory.ModifiedWhileReading instance GHC.Show.Show Data.JSON.Directory.NoRuleFor instance GHC.Exception.Type.Exception Data.JSON.Directory.NoRuleFor instance GHC.Exception.Type.Exception Data.JSON.Directory.ModifiedWhileReading