feat: instances for Arbitrary
This commit is contained in:
parent
13a2577ae2
commit
8181113bfe
6 changed files with 83 additions and 16 deletions
|
@ -1,12 +1,23 @@
|
|||
{-# LANGUAGE Safe #-}
|
||||
{-# LANGUAGE InstanceSigs #-}
|
||||
module Language.Scalie.Ast.Expression (Expression(..)) where
|
||||
|
||||
import Prelude (Integer)
|
||||
import Data.Kind (Type)
|
||||
import Text.Show (Show)
|
||||
import Text.Read (Read)
|
||||
import Data.Eq (Eq)
|
||||
import Test.QuickCheck (Arbitrary (arbitrary), Gen, oneof)
|
||||
import Data.Functor ((<$>))
|
||||
|
||||
type Expression :: Type
|
||||
data Expression
|
||||
= RawInt Integer
|
||||
deriving stock (Show, Read)
|
||||
deriving stock (Show, Read, Eq)
|
||||
|
||||
instance Arbitrary Expression where
|
||||
arbitrary :: Gen Expression
|
||||
arbitrary = oneof
|
||||
[ RawInt <$> arbitrary
|
||||
]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue