From: Michael Orlitzky Date: Sun, 9 May 2010 17:40:46 +0000 (-0400) Subject: Added the decrement function for Maskbits. X-Git-Tag: 0.0.1~59 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=faf538fda9564ceb68774ac4bf5981fddb427b38;p=hath.git Added the decrement function for Maskbits. --- diff --git a/src/Maskbits.hs b/src/Maskbits.hs index fcf57bd..ed358b9 100644 --- a/src/Maskbits.hs +++ b/src/Maskbits.hs @@ -1,5 +1,6 @@ module Maskbits ( Maskbits(..), + decrement, maskbits_from_string ) where @@ -123,3 +124,41 @@ maskbits_from_string s = case (reads s :: [(Int, String)]) of [] -> None x:_ -> maskbits_from_int (fst x) + + + +decrement :: Maskbits -> Maskbits +decrement None = None +decrement Zero = None +decrement One = Zero +decrement Two = One +decrement Three = Two +decrement Four = Three +decrement Five = Four +decrement Six = Five +decrement Seven = Six +decrement Eight = Seven +decrement Nine = Eight +decrement Ten = Nine +decrement Eleven = Ten +decrement Twelve = Eleven +decrement Thirteen = Twelve +decrement Fourteen = Thirteen +decrement Fifteen = Fourteen +decrement Sixteen = Fifteen +decrement Seventeen = Sixteen +decrement Eighteen = Seventeen +decrement Nineteen = Eighteen +decrement Twenty = Nineteen +decrement TwentyOne = Twenty +decrement TwentyTwo = TwentyOne +decrement TwentyThree = TwentyTwo +decrement TwentyFour = TwentyThree +decrement TwentyFive = TwentyFour +decrement TwentySix = TwentyFive +decrement TwentySeven = TwentySix +decrement TwentyEight = TwentySeven +decrement TwentyNine = TwentyEight +decrement Thirty = TwentyNine +decrement ThirtyOne = Thirty +decrement ThirtyTwo = ThirtyOne