X-Git-Url: http://gitweb.michael.orlitzky.com/?p=list-remote-forwards.git;a=blobdiff_plain;f=src%2FForward.hs;h=8d977fac299e46017850efdcc625fa99a9001ca3;hp=7de53b858375287049f4e1c692f56316e28b18c6;hb=34d9cc7a2def43cb2d588ee3d1d405f0b9d4a1d0;hpb=f75845314598408bce3a1b972f2ba274d93d0e8d diff --git a/src/Forward.hs b/src/Forward.hs index 7de53b8..8d977fa 100644 --- a/src/Forward.hs +++ b/src/Forward.hs @@ -22,14 +22,14 @@ type Domain = String -- a 'String'. This differs from a 'Goto' in that it should only -- appear on the left-hand-side of a alias -> goto relationship. -- -newtype Address = Address String deriving ( Show ) +newtype Address = Address String deriving ( Eq, Show ) -- | A type-safe wrapper around an email address that's represented as -- a 'String'. This differs from 'Address' in that 'Goto' addresses -- are the destinations of mail that is forwarded, rather than the -- source. -newtype Goto = Goto String deriving ( Show ) +newtype Goto = Goto String deriving ( Eq, Show ) -- | A data type representing a "forward." That is, an email address @@ -41,7 +41,7 @@ newtype Goto = Goto String deriving ( Show ) -- data Forward = Forward Address Goto - deriving (Show) + deriving ( Eq, Show ) -- | Shortcut constructor for creating 'Forward' objects. @@ -214,8 +214,8 @@ address_domain (Forward (Address addr) _) = domain_part addr domain_part :: String -> Maybe Domain domain_part address = case parts of - (_:domain:[]) -> Just domain - _ -> Nothing + [_,domain] -> Just domain + _ -> Nothing where parts = split "@" address