mirror of
https://github.com/srid/ema.git
synced 2024-11-25 20:12:20 +03:00
slug: derive Data and Generic
This commit is contained in:
parent
560d074241
commit
735b182dc8
@ -3,7 +3,7 @@
|
||||
## Unreleased (0.2.0.0)
|
||||
|
||||
- `Ema.Slug`
|
||||
- Add `Ord` instance to `Slug`
|
||||
- Add `Ord`, `Generic` and `Data` instances to `Slug`
|
||||
- Unicode normalize slugs using NFC
|
||||
- TODO(doc) Add `decodeSlug` and `encodeSlug`
|
||||
- Add default implementation based on Enum for `staticRoute`
|
||||
|
@ -1,14 +1,17 @@
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE InstanceSigs #-}
|
||||
|
||||
module Ema.Route.Slug where
|
||||
|
||||
import Data.Data (Data)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Normalize as UT
|
||||
import qualified Network.URI.Encode as UE
|
||||
|
||||
-- | An URL path is made of multiple slugs, separated by '/'
|
||||
newtype Slug = Slug {unSlug :: Text}
|
||||
deriving (Eq, Show, Ord)
|
||||
deriving (Eq, Show, Ord, Data, Generic)
|
||||
|
||||
-- | Decode an URL component into a `Slug` using `Network.URI.Encode`
|
||||
decodeSlug :: Text -> Slug
|
||||
|
Loading…
Reference in New Issue
Block a user