ContinueAfterFailSpec.hs 558 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
{-# LANGUAGE FlexibleInstances #-}

module SumTypes.ContinueAfterFailSpec where

import Prelude hiding (lookup,(*), (**))
import Test.Hspec

import SumTypes.Base as B
import SumTypes.SharedSpecs
import SumTypes.ContinueAfterCheckFail as C
import SumTypes.Language
12
import Control.Monad.Writer.Lazy (Writer, runWriter)
13

14 15 16 17 18
instance ConvertToBInfer (Writer C.Error) where
  convert m =
    case runWriter m of
      (t,[]) -> Inferred t
      (t,err) -> NotInferred (head err)
19 20 21 22 23 24 25 26

main :: IO ()
main = hspec spec

spec :: Spec
spec = sharedSpec $ C.inferType Empty