From: Michael Orlitzky Date: Sat, 8 May 2010 16:57:14 +0000 (-0400) Subject: Defined a show instance for IPv4Address. X-Git-Tag: 0.0.1~64 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=hath.git;a=commitdiff_plain;h=031b95f3bf040669ec28d29af0577ce58b5c1f68 Defined a show instance for IPv4Address. --- diff --git a/src/IPv4Address.hs b/src/IPv4Address.hs index 8c5d483..5296b24 100644 --- a/src/IPv4Address.hs +++ b/src/IPv4Address.hs @@ -24,7 +24,20 @@ data IPv4Address = None | IPv4Address { octet1 :: Octet, octet2 :: Octet, octet3 :: Octet, octet4 :: Octet } - deriving (Eq, Show) + deriving (Eq) + + +instance Show IPv4Address where + show IPv4Address.None = "None" + show addr = concat [(show oct1) ++ ".", + (show oct2) ++ ".", + (show oct3) ++ ".", + (show oct4)] + where + oct1 = (octet1 addr) + oct2 = (octet2 addr) + oct3 = (octet3 addr) + oct4 = (octet4 addr) -- We don't export our constructor so this function is the only