1
Fork 0
solar-conflux/purescript/slice/src/Main.purs
2023-10-29 01:21:05 +02:00

20 lines
450 B
Plaintext

module Main where
import Prelude
import Benchmarks (benchSum)
import Benchotron.UI.Console (runSuite)
import Control.Monad.ST.Internal as ST
import Control.Monad.ST.Internal as STRef
import Effect (Effect)
factorial :: Int -> Int
factorial to = ST.run do
result <- STRef.new 1
ST.for 2 to \index -> do
current <- STRef.read result
STRef.write (current * index) result
STRef.read result
main :: Effect Unit
main = runSuite [benchSum]