module Main where import Control.Arrow import Simplicity.Ty.Bit (Bit, toBit) import Simplicity.Ty.Word import Simplicity.Programs.Word (fullAdder) type WT = Word256 wtyp = word256 f1 :: WT -> WT -> WT f1 x y = n where (_carry, n) = fullAdder wtyp ((x, y), toBit False) {-# RULES "fullAdderOpt" (Monad m) => forall w. fullAdder w = Kleisli (\((a,b),c) -> return $ let sum = fromWord w a + fromWord w b + fromWord1 c in (toBit (sum >= 2 ^ wordSize w), toWord w sum)) #-} primcalc = foldr (\elem acc -> f1 elem acc) (toWord wtyp 1) (fmap (toWord wtyp) [1..2000]) main :: IO () main = do let (o1, o2) = primcalc print o1 print o2 pure ()