Skip to content

Instantly share code, notes, and snippets.

@Jell
Created December 7, 2018 12:22
Show Gist options
  • Save Jell/a1fdc65098fecfd73f15ac5027c6709b to your computer and use it in GitHub Desktop.
Save Jell/a1fdc65098fecfd73f15ac5027c6709b to your computer and use it in GitHub Desktop.
module Test
import TestProvider
%default total
%language TypeProviders
add : Int -> Int -> Int
add x y = 0
%provide (result : String) with compileTest [
(add 1 2 == 0, "1 + 2 = 3")
, (add 1 2 == 0, "1 + 2 = 3")
, (add 1 2 == 0, "1 + 2 = 3")
]
module TestProvider
%default total
%access export
compileTest : List (Bool, String) -> IO (Provider String)
compileTest [] = pure $ Provide "success"
compileTest ((True, _) :: xs) = do
printLn "pass"
compileTest xs
compileTest ((False, description) :: xs) = do
printLn "failed"
pure $ Error description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment