1234567891011121314151617181920212223 |
- {-# LANGUAGE OverloadedStrings #-}
- module Data.SMTP.Types.URI where
- import Data.SMTP.Account
- import qualified Data.ByteString as BS
- import Text.StringConvert
- newtype Path = Path FilePath 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)
- fullURI :: URI -> BS.ByteString
- fullURI (URI a (Path p) r) = let bg = BS.concat ["FCMTP://", fullAccount a, s p]
- in case r of
- Nothing -> bg
- Just (Revision r') -> BS.concat[bg, "#", s r']
- instance Show URI where
- show = toString . fullURI
|