mirror of
https://github.com/polysemy-research/polysemy.git
synced 2024-09-11 02:25:43 +03:00
* Move Polysemy.Internal.Lift to Polysemy.Lift.Type * Add Polysemy.Lift module and runLift interpreter * Add a Sandy reminder * Add explicit foralls and split type signature * Fix import spacing, for there is no "qualified" * Implement runIO in terms of runLift * Rename Lift -> Embed * Replace sendM with embed * Add a Sandy todo for embed version * Rename runEmbed and related runEmbedded (from IO) * runEmbedded -> runEmbeddedInIO * runEmbed -> runEmbedded * Update cabal
26 lines
606 B
Haskell
26 lines
606 B
Haskell
{-# OPTIONS_GHC -fdefer-type-errors -fno-warn-deferred-type-errors #-}
|
|
|
|
module LegitimateTypeErrorSpec where
|
|
|
|
import Polysemy
|
|
import Test.Hspec
|
|
import Test.ShouldNotTypecheck
|
|
|
|
wrongEmbed :: Member (Embed IO) r => Sem r ()
|
|
wrongEmbed = embed putStrLn
|
|
|
|
wrongReturn :: Sem (e ': r) () -> Sem r ()
|
|
wrongReturn = reinterpret undefined
|
|
|
|
|
|
|
|
spec :: Spec
|
|
spec = do
|
|
describe "Legitimate type errors" $ do
|
|
it "should be caused by `embed`ing an unsaturated function" $
|
|
shouldNotTypecheck wrongEmbed
|
|
|
|
it "should be caused by giving a bad type to reinterpret" $
|
|
shouldNotTypecheck wrongReturn
|
|
|