Skip to content
Closed
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
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ on:
pull_request:
branches: [master]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"
- uses: actions/checkout@v6

- uses: actions/setup-node@v2
- uses: actions/setup-node@v6
with:
node-version: "14.x"
node-version: "24"

- name: Install dependencies
run: |
npm install -g bower
npm install
bower install --production
run: npm install

- name: Build source
run: npm run-script build
run: npm run build

- name: Run tests
run: |
bower install
npm run-script test --if-present
run: npm test

- name: Lint
run: npm run lint

- name: Check formatting
run: npm run format:check
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/.*
!/.gitignore
!/.github/
package-lock.json
/bower_components/
!/.tidyrc.json
/package-lock.json
/spago.lock
/node_modules/
/output/
10 changes: 10 additions & 0 deletions .tidyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"importSort": "ide",
"importWrap": "source",
"indent": 2,
"operatorsFile": null,
"ribbon": 1,
"typeArrowPlacement": "first",
"unicode": "never",
"width": null
}
25 changes: 17 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,28 @@

Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

Breaking changes:

New features:

Bugfixes:
## [v6.1.1](https://github.com/purescript/purescript-transformers/releases/tag/v6.1.1)

Other improvements:

- Migrate from Bower/Pulp to Spago and update CI, linting, and formatting (#150 by @thomashoneyman).

## [v6.1.0](https://github.com/purescript/purescript-transformers/releases/tag/v6.1.0) - 2024-06-26

New features:

- Add `MonadST` instances for all monad transformers (#147 by @rhendric)
- Add `ComonadAsk`, `ComonadEnv`, and `ComonadTraced` instances for `StoreT`, `EnvT`, and `TracedT` (#145 by @skeate)

## [v6.0.0](https://github.com/purescript/purescript-transformers/releases/tag/v6.0.0) - 2022-04-27

Breaking changes:

- Update project and deps to PureScript v0.15.0 (#142 by @JordanMartinez)
- Drop deprecated `MonadZero` instance (#141 by @JordanMartinez)

New features:

- Add `Foldable`, `FoldableWithIndex`, and `Traversable` instances for `EnvT` (#113 by @abaco)

Bugfixes:
Expand All @@ -34,30 +33,37 @@ Other improvements:
## [v5.2.0](https://github.com/purescript/purescript-transformers/releases/tag/v5.2.0) - 2021-07-13

New features:
- Add `liftMaybe` and `liftEither` to easily lift `Maybe` and `Either` values to a `MonadThrow` monad (#140 by @hexagonal-sun)

- Add `liftMaybe` and `liftEither` to easily lift `Maybe` and `Either` values to a `MonadThrow` monad (#140 by @hexagonal-sun)

## [v5.1.0](https://github.com/purescript/purescript-transformers/releases/tag/v5.1.0) - 2021-04-27

New features:

- Export `mapCont` and `withCont` functions originally added in #70 by @parsonsmatt (#139 by @JordanMartinez)

Other improvements:

- Fix warnings revealed by v0.14.1 PS release (#139 by @JordanMartinez)

## [v5.0.0](https://github.com/purescript/purescript-transformers/releases/tag/v5.0.0) - 2021-02-26

Breaking changes:

- Added support for PureScript 0.14 and dropped support for all previous versions (#133)
- Replaced `ComonadEnv` constraint with `ComonadAsk` in the `asks` function (#131)

New features:

- Added `Semigroup` and `Monoid` instances to `ContT`, `ExceptT`, `MaybeT`, `RWST`, `StateT`, `WriterT` (#115)
- Added `IdentityT` (#121)

Bugfixes:

- Added `Semigroup` and `Monoid` superclasses to `MonadTell` and `MonadWriter`, respectively, to enforce the type class laws (#126)

Other improvements:

- Replaced `void $ modify` with `modify_` in example code (#119)
- Fixed documentation to use `Effect` instead of `Eff` (#124)
- Fixed documentation for `callCC` (#132)
Expand Down Expand Up @@ -132,6 +138,7 @@ Other improvements:
## [v2.0.0](https://github.com/purescript/purescript-transformers/releases/tag/v2.0.0) - 2016-10-10

This release features a number of breaking changes:

- The signature for `callCC` is now rank-2 to allow for any result to be discarded #74 (@jqyu)
- Functional dependencies have been added to all classes
- `Newtype` instances have been derived for all transformers
Expand Down Expand Up @@ -179,6 +186,7 @@ Relax constraints for `WriterT` instances (@xuwei-k)
## [v0.7.1](https://github.com/purescript/purescript-transformers/releases/tag/v0.7.1) - 2015-08-25

This release requires the 0.7.4.0 release of the PureScript compiler. Previous versions of this library will _not_ work with `psc` versions <= 0.7.3.0.

- Simplified instance constraints.
- Module reexports of `Class` modules.
- More instances for `ExceptT`
Expand Down Expand Up @@ -217,6 +225,7 @@ This release works with versions 0.7.\* of the PureScript compiler. It will not
## [v0.5.0](https://github.com/purescript/purescript-transformers/releases/tag/v0.5.0) - 2015-02-21

**This release requires PureScript v0.6.8 or later**

- Updated dependencies

## [v0.4.1](https://github.com/purescript/purescript-transformers/releases/tag/v0.4.1) - 2015-02-19
Expand Down
46 changes: 0 additions & 46 deletions bower.json

This file was deleted.

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build -- --censor-lib --strict",
"test": "pulp test"
"build": "spago build",
"test": "spago test",
"lint": "oxlint --deny-warnings src test",
"format": "purs-tidy format-in-place src test && oxfmt --write .",
"format:check": "purs-tidy check src test && oxfmt --check ."
},
"devDependencies": {
"pulp": "16.0.0-0",
"purescript-psa": "^0.8.2",
"rimraf": "^3.0.2"
"oxfmt": "^0.73.0",
"oxlint": "^1.88.0",
"purescript": "^0.15.16",
"purs-tidy": "^0.11.1",
"spago": "^1.0.5"
}
}
37 changes: 37 additions & 0 deletions spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package:
name: transformers
description: Monad and comonad transformers based on mtl
build:
strict: true
pedanticPackages: true
publish:
version: 6.1.1
license: BSD-3-Clause
location:
githubOwner: purescript
githubRepo: purescript-transformers
dependencies:
- control: ">=6.0.0 <7.0.0"
- distributive: ">=6.0.0 <7.0.0"
- effect: ">=4.0.0 <5.0.0"
- either: ">=6.0.0 <7.0.0"
- exceptions: ">=6.0.0 <7.0.0"
- foldable-traversable: ">=6.0.0 <7.0.0"
- identity: ">=6.0.0 <7.0.0"
- lazy: ">=6.0.0 <7.0.0"
- maybe: ">=6.0.0 <7.0.0"
- newtype: ">=5.0.0 <6.0.0"
- prelude: ">=6.0.0 <7.0.0"
- st: ">=6.2.0 <7.0.0"
- tailrec: ">=6.0.0 <7.0.0"
- tuples: ">=7.0.0 <8.0.0"
- unfoldable: ">=6.0.0 <7.0.0"
test:
main: Test.Main
strict: true
pedanticPackages: true
dependencies:
- arrays: ">=7.0.0 <8.0.0"
- console: ">=6.0.0 <7.0.0"
- partial: ">=4.0.0 <5.0.0"
workspace: {}
1 change: 0 additions & 1 deletion src/Control/Comonad/Env.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Prelude

import Control.Comonad.Env.Class (class ComonadEnv, ask, asks, local)
import Control.Comonad.Env.Trans (EnvT(..), mapEnvT, runEnvT, withEnvT)

import Data.Identity (Identity(..))
import Data.Newtype (unwrap)
import Data.Tuple (Tuple(..))
Expand Down
2 changes: 1 addition & 1 deletion src/Control/Comonad/Env/Class.purs
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ instance comonadAskStoreT :: ComonadAsk e w => ComonadAsk e (StoreT s w) where
ask = ask <<< lower

instance comonadEnvStoreT :: ComonadEnv e w => ComonadEnv e (StoreT s w) where
local f (StoreT (Tuple w s)) = StoreT (Tuple (local f w) s)
local f (StoreT (Tuple w s)) = StoreT (Tuple (local f w) s)
7 changes: 3 additions & 4 deletions src/Control/Comonad/Env/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import Prelude
import Control.Comonad (class Comonad, extract)
import Control.Comonad.Trans.Class (class ComonadTrans)
import Control.Extend (class Extend, (<<=))

import Data.FoldableWithIndex (class FoldableWithIndex, foldrWithIndex, foldlWithIndex, foldMapWithIndex)
import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex)
import Data.FunctorWithIndex (class FunctorWithIndex, mapWithIndex)
import Data.Traversable (class Traversable, class Foldable, foldl, foldr, foldMap, traverse, sequence)
import Data.Newtype (class Newtype)
import Data.Traversable (class Foldable, class Traversable, foldMap, foldl, foldr, sequence, traverse)
import Data.TraversableWithIndex (class TraversableWithIndex, traverseWithIndex)
import Data.Tuple (Tuple(..))
import Data.Newtype (class Newtype)

-- | The environment comonad transformer.
-- |
Expand Down
1 change: 0 additions & 1 deletion src/Control/Comonad/Store.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Prelude

import Control.Comonad.Store.Class (class ComonadStore, experiment, peek, peeks, pos, seek, seeks)
import Control.Comonad.Store.Trans (StoreT(..), runStoreT)

import Data.Identity (Identity(..))
import Data.Newtype (unwrap)
import Data.Tuple (Tuple(..), swap)
Expand Down
3 changes: 1 addition & 2 deletions src/Control/Comonad/Store/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import Prelude
import Control.Comonad (class Comonad, extract)
import Control.Comonad.Trans.Class (class ComonadTrans)
import Control.Extend (class Extend, (<<=))

import Data.Tuple (Tuple(..))
import Data.Newtype (class Newtype)
import Data.Tuple (Tuple(..))

-- | The store comonad transformer.
-- |
Expand Down
1 change: 0 additions & 1 deletion src/Control/Comonad/Traced.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Prelude

import Control.Comonad.Traced.Class (class ComonadTraced, censor, listen, listens, track, tracks)
import Control.Comonad.Traced.Trans (TracedT(..), runTracedT)

import Data.Identity (Identity(..))
import Data.Newtype (unwrap)

Expand Down
1 change: 0 additions & 1 deletion src/Control/Monad/Cont.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Prelude

import Control.Monad.Cont.Class (class MonadCont, callCC)
import Control.Monad.Cont.Trans (class MonadTrans, ContT(..), lift, mapContT, runContT, withContT)

import Data.Identity (Identity(..))
import Data.Newtype (unwrap)

Expand Down
5 changes: 4 additions & 1 deletion src/Control/Monad/Cont/Trans.purs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
-- | This module defines the CPS monad transformer.

module Control.Monad.Cont.Trans
( ContT(..), runContT, mapContT, withContT
( ContT(..)
, runContT
, mapContT
, withContT
, module Control.Monad.Trans.Class
, module Control.Monad.Cont.Class
) where
Expand Down
10 changes: 4 additions & 6 deletions src/Control/Monad/Error/Class.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Data.Maybe (Maybe(..), maybe)
import Effect (Effect)
import Effect.Exception as Ex


-- | The `MonadThrow` type class represents those monads which support errors via
-- | `throwError`, where `throwError e` halts, yielding the error `e`.
-- |
Expand Down Expand Up @@ -48,8 +47,8 @@ catchJust
:: forall e m a b
. MonadError e m
=> (e -> Maybe b) -- ^ Predicate to select exceptions
-> m a -- ^ Computation to run
-> (b -> m a) -- ^ Handler
-> m a -- ^ Computation to run
-> (b -> m a) -- ^ Handler
-> m a
catchJust p act handler = catchError act handle
where
Expand Down Expand Up @@ -77,16 +76,15 @@ instance monadThrowMaybe :: MonadThrow Unit Maybe where
throwError = const Nothing

instance monadErrorMaybe :: MonadError Unit Maybe where
catchError Nothing f = f unit
catchError Nothing f = f unit
catchError (Just a) _ = Just a

instance monadThrowEffect :: MonadThrow Ex.Error Effect where
throwError = Ex.throwException

instance monadErrorEffect :: MonadError Ex.Error Effect where
catchError = flip Ex.catchException


-- | Make sure that a resource is cleaned up in the event of an exception. The
-- | release action is called regardless of whether the body action throws or
-- | returns.
Expand Down
Loading
Loading