-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Some extensions to Chris Done's path library, for use with urlpath and attoparsec-uri. -- -- Please see the README on Github at -- https://github.com/githubuser/localcooking-db#readme @package path-extra @version 0.1.1 module Path.Extended -- | A location for some base and type - internally uses Path. data Location b t Location :: Int -> Path b t -> Maybe String -> [QueryParam] -> Maybe String -> Location b t -- | only when b ~ Rel [locParentJumps] :: Location b t -> Int [locPath] :: Location b t -> Path b t -- | only when t ~ File [locFileExt] :: Location b t -> Maybe String [locQueryParams] :: Location b t -> [QueryParam] [locFragment] :: Location b t -> Maybe String type QueryParam = (String, Maybe String) -- | Convenience typeclass for symbolic, stringless routes - make an -- instance for your own data type to use your constructors as -- route-referencing symbols. class ToPath sym base type' | sym -> base type' toPath :: ToPath sym base type' => sym -> Path base type' -- | Convenience typeclass for symbolic, stringless routes - make an -- instance for your own data type to use your constructors as -- route-referencing symbols. class ToLocation sym base type' | sym -> base type' toLocation :: ToLocation sym base type' => sym -> Location base type' class FromPath sym base type' | sym -> base type' parsePath :: FromPath sym base type' => Path base type' -> Either String sym class FromLocation sym base type' | sym -> base type' parseLocation :: FromLocation sym base type' => Location base type' -> Either String sym class PathAppend right base type' () :: PathAppend right base type' => Path base Dir -> right Rel type' -> right base type' -- | Prepend a parental accessor path - ../ addParent :: Location Rel t -> Location Rel t delParent :: Location Rel t -> Location Rel t -- | This should be your entry point for creating a Location. fromPath :: Path b t -> Location b t setFileExt :: Maybe String -> Location b File -> Location b File addFileExt :: String -> Location b File -> Location b File delFileExt :: Location b File -> Location b File getFileExt :: Location b File -> Maybe String setQuery :: [QueryParam] -> Location b t -> Location b t -- | Appends a query parameter addQuery :: QueryParam -> Location b t -> Location b t (<&>) :: Location b t -> QueryParam -> Location b t infixl 7 <&> addQueries :: [QueryParam] -> Location b t -> Location b t delQuery :: Location b t -> Location b t getQuery :: Location b t -> [QueryParam] setFragment :: Maybe String -> Location b t -> Location b t addFragment :: String -> Location b t -> Location b t (<#>) :: Location b t -> String -> Location b t infixl 8 <#> delFragment :: Location b t -> Location b t getFragment :: Location b t -> Maybe String instance GHC.Classes.Ord (Path.Extended.Location b t) instance GHC.Classes.Eq (Path.Extended.Location b t) instance Path.Extended.PathAppend Path.Extended.Location Path.Abs Path.Dir instance Path.Extended.PathAppend Path.Extended.Location Path.Abs Path.File instance Path.Extended.PathAppend Path.Extended.Location Path.Rel Path.Dir instance Path.Extended.PathAppend Path.Extended.Location Path.Rel Path.File instance GHC.Show.Show (Path.Extended.Location b t) instance Path.Extended.PathAppend Path.Internal.Path Path.Abs Path.Dir instance Path.Extended.PathAppend Path.Internal.Path Path.Abs Path.File instance Path.Extended.PathAppend Path.Internal.Path Path.Rel Path.Dir instance Path.Extended.PathAppend Path.Internal.Path Path.Rel Path.File