123456789101112131415161718192021222324252627 |
- {-# LANGUAGE OverloadedStrings #-}
- module Data.SMTP.Types.URI where
- import Data.SMTP.Account
- import Data.List
- import Text.StringConvert
- newtype Path = Path [String] deriving (Eq, Ord, Read, Show)
- newtype Revision = Revision String deriving (Eq, Ord, Read, Show)
- data URI = URI {account :: Account, path :: Path, revision :: Maybe Revision}
- deriving (Eq, Ord, Read)
- fullPath :: URI -> String
- fullPath URI{path=Path p} = "/" ++ intercalate "/" p
- fullURI :: URI -> String
- fullURI u@(URI{account=a, revision=r}) =
- concat $ ["FCMTP://", s . fullAccount $ a, fullPath u] ++
- case r of
- Nothing -> []
- Just (Revision r') -> [":", r']
- instance Show URI where
- show = toString . fullURI
|