Web.PathPieces

path-pieces-0.2.1: Components of paths.

Safe Haskell | Safe
Language | Haskell98

Web.PathPieces

Contents

- Deprecated

Synopsis

- class PathPiece s where
  - fromPathPiece :: Text -> Maybe s
  - toPathPiece :: s -> Text
- class PathMultiPiece s where
  - fromPathMultiPiece :: [Text] -> Maybe s
  - toPathMultiPiece :: s -> [Text]
- readFromPathPiece :: Read s => Text -> Maybe s
- showToPathPiece :: Show s => s -> Text
- toSinglePiece :: PathPiece p => p -> Text
- toMultiPiece :: PathMultiPiece ps => ps -> [Text]
- fromSinglePiece :: PathPiece p => Text -> Maybe p
- fromMultiPiece :: PathMultiPiece ps => [Text] -> Maybe ps

# Documentation

class PathPiece s where

Methods

fromPathPiece :: Text -> Maybe s

toPathPiece :: s -> Text

Instances

PathPiece Bool |
PathPiece Int |
PathPiece Int8 |
PathPiece Int16 |
PathPiece Int32 |
PathPiece Int64 |
PathPiece Integer |
PathPiece Word |
PathPiece Word8 |
PathPiece Word16 |
PathPiece Word32 |
PathPiece Word64 |
PathPiece String |
PathPiece () |
PathPiece Text |
PathPiece Text |
PathPiece Day |
PathPiece a => PathPiece (Maybe a) |

class PathMultiPiece s where

Methods

fromPathMultiPiece :: [Text] -> Maybe s

toPathMultiPiece :: s -> [Text]

Instances

PathPiece a => PathMultiPiece [a] |

readFromPathPiece :: Read s => Text -> Maybe s

A function for helping generate free `PathPiece` instances for enumeration data types that have derived `Read` and `Show` instances. Intended to be used like this:

    data MyData = Foo | Bar | Baz
      deriving (Read,Show)
    instance PathPiece MyData where
      fromPathPiece = readFromPathPiece
      toPathPiece = showToPathPiece

Since 0.2.1.

showToPathPiece :: Show s => s -> Text

See the documentation for `readFromPathPiece`.

Since 0.2.1.

# Deprecated

toSinglePiece :: PathPiece p => p -> Text

Deprecated: Use toPathPiece instead of toSinglePiece

toMultiPiece :: PathMultiPiece ps => ps -> [Text]

Deprecated: Use toPathMultiPiece instead of toMultiPiece

fromSinglePiece :: PathPiece p => Text -> Maybe p

Deprecated: Use fromPathPiece instead of fromSinglePiece

fromMultiPiece :: PathMultiPiece ps => [Text] -> Maybe ps

Deprecated: Use fromPathMultiPiece instead of fromMultiPiece