Skip to content

polysemy-research/polysemy-check

Repository files navigation

polysemy-check

Hackage

Dedication

Success is most often achieved by those who don't know that failure is inevitable.

--Coco Chanel

Overview

polysemy-check is a little package that integrates polysemy with QuickCheck. It allows you to prove the equivalence of effects (see prepropLaw), the equivalence of interpreters (prepropEquivalent), and that two effects don't affect one another (prepropCommutative). These three things are about the only problems you could possibly run into with Polysemy --- and now you won't.

In addition polysemy-check provides lots of machinery to help avoid boilerplate, such as free Arbitrary instances for effects.

Usage

polysemy-check requires a Show and GenericK instance for every effect you'd like to run tests over.

{-# LANGUAGE TemplateHaskell #-}

import Polysemy
import Polysemy.Check

data Stack m a where
  Push :: Int -> Stack m ()
  Pop  :: Stack m (Maybe Int)
  Size :: Stack m Int

deriving instance Show (Stack m a)
makeSem ''Stack
deriveGenericK ''Stack

Examples

Check the test suite.