Skip to content

Instantly share code, notes, and snippets.

@johnwesonga
Last active March 18, 2018 22:19
Show Gist options
  • Save johnwesonga/2f4a4b8ad8e007266f8e6f93ca0fdf30 to your computer and use it in GitHub Desktop.
Save johnwesonga/2f4a4b8ad8e007266f8e6f93ca0fdf30 to your computer and use it in GitHub Desktop.
Factorial in PureScript
module Main where
import Prelude (show, ($), (=<<), (+), (<>), (*), (-))
import Control.Monad.Eff.Console(log)
import TryPureScript
fact :: Int -> Int
fact 0 = 1
fact n = n * fact(n-1)
main = render =<< withConsole do
log $ show $ fact 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment