Created
September 19, 2015 00:26
-
-
Save cjlarose/20992322b22a2bba637e to your computer and use it in GitHub Desktop.
Default implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bytes a where | |
toBytes :: a -> List UInt8 | |
width :: Int | |
addWithCarry :: a -> a -> (Tuple Boolean a) | |
default addWithCarry a b = case (addLists (toBytes a) (toBytes b)) of | |
(Cons 0 sum) -> (Tuple false a) | |
(Cons 1 sum) -> (Tuple true a) | |
otherwise -> error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment