File: nat.hs

package info (click to toggle)
haskell-type-level-numbers 0.1.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 136 kB
  • sloc: haskell: 663; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE TemplateHaskell #-}
import Control.Applicative
import Language.Haskell.TH
import System.Exit

import TestNat


main :: IO ()
main = do
  plus  <- sequence $(listE (testAdd <$> [0..8] <*> [0..8]))
  minus <- sequence $(listE [testSub n m | m <- [0..8], n <- [m..8]])
  mult  <- sequence $(listE (testMul <$> [0..8] <*> [0..8]))
  case and $ plus ++ minus ++ mult of
    True  -> exitSuccess
    False -> exitFailure