Created
May 28, 2025 13:49
-
-
Save ymdfield/ffb7038dfd6d755fa6dc2eebcc30edbb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S cabal run -v1 | |
| {- cabal: | |
| build-depends: base, heftia-effects ^>= 0.7 | |
| ghc-options: -Wall | |
| -} | |
| {-# LANGUAGE GHC2021 #-} | |
| {-# LANGUAGE AllowAmbiguousTypes #-} | |
| {-# LANGUAGE BlockArguments #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| import Control.Monad.Hefty | |
| import Control.Monad.Hefty.NonDet | |
| import Control.Monad.Hefty.State | |
| testProgram :: (State String :> es, Choose :> es) => Eff es Int | |
| testProgram = do | |
| () <- pure () `branch` pure () | |
| s <- get | |
| put "modified" | |
| pure $ length s | |
| main :: IO () | |
| main = runEff do | |
| _ <- runNonDet @[] do | |
| x <- runState "unmodified" testProgram | |
| liftIO $ print x | |
| pure () | |
| -- > main | |
| -- ("modified",10) | |
| -- ("modified",10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment