fix catching of exceptions in tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{-# LANGUAGE TemplateHaskellQuotes #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
module Gyehoek.Stack.Syntax
|
||||
( Program(..)
|
||||
, Block(..)
|
||||
@@ -32,6 +33,7 @@ import Effectful
|
||||
import Gyehoek.Scheme.Syntax (Name(..), Lit(..), Prim(..))
|
||||
import GHC.Exts (IsList(..))
|
||||
import Data.List (intersperse)
|
||||
import Control.DeepSeq (NFData)
|
||||
|
||||
|
||||
newtype Program = MkProgram
|
||||
@@ -39,6 +41,7 @@ newtype Program = MkProgram
|
||||
}
|
||||
deriving stock (Show, Generic, Data)
|
||||
deriving newtype (Semigroup, Monoid)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
instance IsList Program where
|
||||
type Item Program = Block
|
||||
@@ -51,6 +54,7 @@ data Block = MkBlock
|
||||
, code :: List Instr
|
||||
}
|
||||
deriving stock (Show, Generic, Data)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
instance Each Block Block Instr Instr where
|
||||
each = #code . each
|
||||
@@ -64,11 +68,13 @@ data Instr
|
||||
| Call Val (List Val)
|
||||
| If Val (List Instr) (List Instr)
|
||||
deriving stock (Show, Generic, Data)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
data Val
|
||||
= ValReg Name
|
||||
| ValImm Imm
|
||||
deriving stock (Show, Generic, Data, Eq)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
pattern ValLabel :: Name -> Val
|
||||
pattern ValLabel x = ValImm (ImmLabel x)
|
||||
@@ -78,10 +84,12 @@ data Imm
|
||||
| ImmBool Bool
|
||||
| ImmLabel Name
|
||||
deriving stock (Show, Generic, Data, Eq)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
data Obj
|
||||
= ObjImm Imm
|
||||
deriving (Show, Generic, Data, Eq)
|
||||
deriving stock (Show, Generic, Data, Eq)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
|
||||
--- sexp work
|
||||
|
||||
Reference in New Issue
Block a user