Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish v2.8.1 #124

Merged
merged 8 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.10.1
compilerKind: ghc
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.8.2
compilerKind: ghc
compilerVersion: 9.8.2
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PVP versioning](https://pvp.haskell.org/).

## v2.8.1 _(2024-11-29)_

### Added
- Added instances `Semigroup`, `Monoid` and `Contravariant` for `Debugger`

## v2.8.0 _(2024-11-28)_

### Changed
Expand Down
7 changes: 4 additions & 3 deletions hasmtlib.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0

name: hasmtlib
version: 2.8.0
version: 2.8.1
synopsis: A monad for interfacing with external SMT solvers
description: Hasmtlib is a library for generating SMTLib2-problems using a monad.
It takes care of encoding your problem, marshaling the data to an external solver and parsing and interpreting the result into Haskell types.
Expand All @@ -21,6 +21,7 @@ extra-doc-files: CHANGELOG.md
tested-with: GHC == 9.4.8
, GHC == 9.6.4
, GHC == 9.8.2
, GHC == 9.10.1

library
hs-source-dirs: src
Expand Down Expand Up @@ -60,8 +61,8 @@ library
build-depends: array >= 0.5 && < 1
, attoparsec >= 0.14.4 && < 1
, base >= 4.17.2 && < 5
, lifted-base >= 0.2 && < 0.5
, monad-control >= 1.0 && < 1.2
, lifted-base >= 0.2 && < 0.5
, monad-control >= 1.0 && < 1.2
, bytestring >= 0.11.5 && < 1
, containers >= 0.6.7 && < 1
, unordered-containers >= 0.2.20 && < 0.3
Expand Down
29 changes: 28 additions & 1 deletion src/Language/Hasmtlib/Type/Debugger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module Language.Hasmtlib.Type.Debugger
, assertionish
, incrementalStackish, getValueish
, responseish

)
where

Expand All @@ -34,6 +33,7 @@ import Data.ByteString.Lazy.UTF8 (toString)
import Data.ByteString.Builder
import qualified Data.ByteString.Lazy.Char8 as ByteString.Char8
import Data.Default
import Data.Functor.Contravariant
import Control.Lens hiding (op)

-- | A type holding actions for debugging states holding SMT-Problems.
Expand All @@ -58,6 +58,33 @@ data Debugger s = Debugger
instance Default (Debugger s) where
def = verbosely

-- | Concats actions
instance Semigroup (Debugger s) where
x <> y = Debugger
(\input -> debugState x input >> debugState y input)
(\input -> debugOption x input >> debugOption y input)
(\input -> debugLogic x input >> debugLogic y input)
(\input -> debugVar x input >> debugVar y input)
(\input -> debugAssert x input >> debugAssert y input)
(\input -> debugPop x input >> debugPop y input)
(\input -> debugCheckSat x input >> debugCheckSat y input)
(\input -> debugGetModel x input >> debugGetModel y input)
(\input -> debugGetValue x input >> debugGetValue y input)
(\input -> debugMinimize x input >> debugMinimize y input)
(\input -> debugMaximize x input >> debugMaximize y input)
(\input -> debugMaximize x input >> debugMaximize y input)
(\input -> debugAssertSoft x input >> debugAssertSoft y input)
(\input -> debugResultResponse x input >> debugResultResponse y input)
(\input -> debugModelResponse x input >> debugModelResponse y input)

instance Monoid (Debugger s) where
mempty = silently

instance Contravariant Debugger where
contramap f' debugger = debugger { debugState = f . f' }
where
f = debugState debugger

printer :: Builder -> IO ()
printer = ByteString.Char8.putStrLn . toLazyByteString

Expand Down