Skip to content

Instantly share code, notes, and snippets.

@Muzietto
Created August 16, 2015 15:59
Show Gist options
  • Save Muzietto/595bef1815ddf375129d to your computer and use it in GitHub Desktop.
Save Muzietto/595bef1815ddf375129d to your computer and use it in GitHub Desktop.
module Mycont_01 where
import Control.Monad.Cont
fattoriale :: Int -> Int
Cont (\c -> c (fattoriale 0)) = return 1
Cont (\c -> c (fattoriale n)) = Cont (\c -> c (fattoriale (n - 1)))
>>= (\x -> Cont (\c -> c (n*x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment