shithub: MicroHs

ref: f7223e89e63a69b557ab4287128d1ec6ef5190c9
dir: /tests/Fac.hs/

View raw version
-- Simple test
module Fac(module Fac) where
import Prelude

fac :: Int -> Int  -- ignored
fac n =
  case n == 0 of
    False -> n * fac (n - 1)
    True  -> 1

nfib :: Int -> Int   -- ignored
nfib n =
  case n < 2 of
    False -> nfib (n - 1) + nfib (n - 2) + 1
    True  -> 1

res :: (Int, Int)
res = (fac 10, nfib 30)

main :: IO ()
main = do
  print $ fac 6
  print $ fst res + snd res