]> gitweb.michael.orlitzky.com - list-remote-forwards.git/blobdiff - src/Forward.hs
Change some doctest examples into unit tests.
[list-remote-forwards.git] / src / Forward.hs
index 7de53b858375287049f4e1c692f56316e28b18c6..8d977fac299e46017850efdcc625fa99a9001ca3 100644 (file)
@@ -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