From 029679192e4f1fd4e0f7df5bac9563000d5aaa0b Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Mon, 7 Dec 2020 18:43:20 -0800 Subject: [PATCH 01/10] Run CI on push / pull_request to master --- .github/workflows/ci.yml | 6 +++++- README.md | 3 ++- package.json | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2972ba..55efa3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI -on: push +on: + push: + branches: [master] + pull_request: + branches: [master] jobs: build: diff --git a/README.md b/README.md index 0edcea3..27bf254 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # purescript-console -[![Latest release](http://img.shields.io/github/release/purescript/purescript-eff.svg)](https://github.com/purescript/purescript-console/releases) +[![Latest release](http://img.shields.io/github/release/purescript/purescript-console.svg)](https://github.com/purescript/purescript-console/releases) [![Build status](https://github.com/purescript/purescript-console/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-console/actions?query=workflow%3ACI+branch%3Amaster) +[![Pursuit](https://pursuit.purescript.org/packages/purescript-console/badge)](https://pursuit.purescript.org/packages/purescript-console) Console-related functions and effect type. diff --git a/package.json b/package.json index bf1e132..1c67b54 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "build": "eslint src && pulp build -- --censor-lib --strict" }, "devDependencies": { - "eslint": "^4.19.1", + "eslint": "^7.15.0", "pulp": "^15.0.0", - "purescript-psa": "^0.6.0", - "rimraf": "^2.6.2" + "purescript-psa": "^0.8.0", + "rimraf": "^3.0.2" } } From 06cb1758ec12d213e8c51ede83ba34fbda46b73d Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Sun, 10 Jan 2021 14:50:54 -0800 Subject: [PATCH 02/10] Generate changelog and add PR template (#33) * Add pull request template * Update CI in PS to v0.14.0-rc5 * Generate CHANGELOG.md file using notes from previous GH releases --- .github/PULL_REQUEST_TEMPLATE.md | 12 ++++++ .github/workflows/ci.yml | 2 +- CHANGELOG.md | 64 ++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CHANGELOG.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4435abb --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,12 @@ +**Description of the change** + +Clearly and concisely describe the purpose of the pull request. If this PR relates to an existing issue or change proposal, please link to it. Include any other background context that would help reviewers understand the motivation for this PR. + +--- + +**Checklist:** + +- [ ] Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)") +- [ ] Linked any existing issues or proposals that this pull request should close +- [ ] Updated or added relevant documentation +- [ ] Added a test for the contribution (if applicable) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55efa3d..f4f44e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - uses: purescript-contrib/setup-purescript@main with: - purescript: "0.14.0-rc3" + purescript: "0.14.0-rc5" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..befd87e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,64 @@ +# Changelog + +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: + +Other improvements: + +## [v4.4.0](https://github.com/purescript/purescript-console/releases/tag/v4.4.0) - 2020-01-26 + +Added `clear` (@iarthstar) + +## [v4.3.0](https://github.com/purescript/purescript-console/releases/tag/v4.3.0) - 2019-12-07 + +Added `timeLog` (@matoruru) + +## [v4.2.0](https://github.com/purescript/purescript-console/releases/tag/v4.2.0) - 2018-11-11 + +- Added `time` and `timeEnd` (@fehrenbach) + +## [v4.1.0](https://github.com/purescript/purescript-console/releases/tag/v4.1.0) - 2018-05-24 + +- Added `Effect.Class.Console`, the console functions lifted for `MonadEffect` (@justinwoo) + +## [v4.0.0](https://github.com/purescript/purescript-console/releases/tag/v4.0.0) - 2018-05-22 + +Updated for PureScript 0.12 + +## [v3.0.0](https://github.com/purescript/purescript-console/releases/tag/v3.0.0) - 2017-03-25 + +- Updated for PureScript 0.11 + +## [v2.0.0](https://github.com/purescript/purescript-console/releases/tag/v2.0.0) - 2016-10-02 + +- Updated dependencies + +## [v1.0.0](https://github.com/purescript/purescript-console/releases/tag/v1.0.0) - 2016-06-01 + +This release is intended for the PureScript 0.9.1 compiler and newer. + +**Note**: The v1.0.0 tag is not meant to indicate the library is “finished”, the core libraries are all being bumped to this for the 0.9 compiler release so as to use semver more correctly. + +## [v1.0.0-rc.1](https://github.com/purescript/purescript-console/releases/tag/v1.0.0-rc.1) - 2016-03-13 + +- Release candidate for the psc 0.8+ core libraries + +## [v0.1.1](https://github.com/purescript/purescript-console/releases/tag/v0.1.1) - 2015-08-20 + +Add `logAny` and `errorAny` (@zudov) + +## [v0.1.0](https://github.com/purescript/purescript-console/releases/tag/v0.1.0) - 2015-06-30 + +This release works with versions 0.7.\* of the PureScript compiler. It will not work with older versions. If you are using an older version, you should require an older, compatible version of this library. + +## [v0.1.0-rc.1](https://github.com/purescript/purescript-console/releases/tag/v0.1.0-rc.1) - 2015-06-06 + +Initial release candidate. + From 6d10c53ad053f3cb48e8a153306ae85fb52812e7 Mon Sep 17 00:00:00 2001 From: milesfrain Date: Mon, 18 Jan 2021 21:56:29 -0800 Subject: [PATCH 03/10] Changelog updates since v4.4.0 (#34) --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index befd87e..e1a9663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: + - Added support for PureScript 0.14 and dropped support for all previous versions (#30) New features: Bugfixes: Other improvements: + - Migrated CI to GitHub Actions and updated installation instructions to use Spago (#32) + - Added a CHANGELOG.md file and pull request template (#33, #34) + - Removed `return {}` from FFI functions for a small performance boost (#30) ## [v4.4.0](https://github.com/purescript/purescript-console/releases/tag/v4.4.0) - 2020-01-26 From d7cb69ef8fed8a51466afe1b623868bb29e8586e Mon Sep 17 00:00:00 2001 From: Cyril Date: Fri, 26 Feb 2021 18:03:24 +0100 Subject: [PATCH 04/10] Prepare v5.0.0 release (#35) Update CI to build with the latest version of the compiler, update the bower repository URL to match the URL in the registry, upgrade bower dependencies, update the changelog. --- .github/workflows/ci.yml | 2 -- CHANGELOG.md | 10 ++++++++++ bower.json | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4f44e5..43d2897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,6 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main - with: - purescript: "0.14.0-rc5" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a9663..bf2d70c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v5.0.0](https://github.com/purescript/purescript-console/releases/tag/v5.0.0) - 2021-02-26 + Breaking changes: - Added support for PureScript 0.14 and dropped support for all previous versions (#30) diff --git a/bower.json b/bower.json index 0b41d73..9e3bec9 100644 --- a/bower.json +++ b/bower.json @@ -4,7 +4,7 @@ "license": "BSD-3-Clause", "repository": { "type": "git", - "url": "git://github.com/purescript/purescript-console.git" + "url": "https://github.com/purescript/purescript-console.git" }, "ignore": [ "**/.*", @@ -16,7 +16,7 @@ "package.json" ], "dependencies": { - "purescript-effect": "master", - "purescript-prelude": "master" + "purescript-effect": "^3.0.0", + "purescript-prelude": "^5.0.0" } } From f674a33fe695c942cee9019ee962a722a01703e3 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Mon, 14 Mar 2022 08:16:40 -0700 Subject: [PATCH 05/10] Update to v0.15.0 (#39) * Convert foreign modules to try bundling with esbuild * Replaced 'export var' with 'export const' * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update pulp to 16.0.0-0 and psa to 0.8.2 * Update Bower dependencies to master * Add changelog entry Co-authored-by: Cyril Sobierajewicz --- .eslintrc.json | 6 ++---- .github/workflows/ci.yml | 2 ++ CHANGELOG.md | 1 + bower.json | 4 ++-- package.json | 4 ++-- src/Effect/Console.js | 18 ++++++++---------- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 144db4a..70febb7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,9 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", - "env": { - "commonjs": true - }, "globals": { "console": true }, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d2897..b6ebf3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index bf2d70c..c556894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Migrated FFI to ES modules (#39 by @kl0tl and @JordanMartinez) New features: diff --git a/bower.json b/bower.json index 9e3bec9..483558f 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,7 @@ "package.json" ], "dependencies": { - "purescript-effect": "^3.0.0", - "purescript-prelude": "^5.0.0" + "purescript-effect": "master", + "purescript-prelude": "master" } } diff --git a/package.json b/package.json index 1c67b54..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ }, "devDependencies": { "eslint": "^7.15.0", - "pulp": "^15.0.0", - "purescript-psa": "^0.8.0", + "pulp": "16.0.0-0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } diff --git a/src/Effect/Console.js b/src/Effect/Console.js index 4009a17..fdf4345 100644 --- a/src/Effect/Console.js +++ b/src/Effect/Console.js @@ -1,47 +1,45 @@ -"use strict"; - -exports.log = function (s) { +export const log = function (s) { return function () { console.log(s); }; }; -exports.warn = function (s) { +export const warn = function (s) { return function () { console.warn(s); }; }; -exports.error = function (s) { +export const error = function (s) { return function () { console.error(s); }; }; -exports.info = function (s) { +export const info = function (s) { return function () { console.info(s); }; }; -exports.time = function (s) { +export const time = function (s) { return function () { console.time(s); }; }; -exports.timeLog = function (s) { +export const timeLog = function (s) { return function () { console.timeLog(s); }; }; -exports.timeEnd = function (s) { +export const timeEnd = function (s) { return function () { console.timeEnd(s); }; }; -exports.clear = function () { +export const clear = function () { console.clear(); }; From 97522ddb7612c61ec01feff6fb2d3ffc22f4a437 Mon Sep 17 00:00:00 2001 From: Maciej Bielecki Date: Mon, 21 Mar 2022 15:20:03 +0100 Subject: [PATCH 06/10] Add `debug` (#36) --- .gitignore | 1 + CHANGELOG.md | 2 ++ package.json | 3 ++- scripts/test | 5 +++++ src/Effect/Class/Console.purs | 6 ++++++ src/Effect/Console.js | 6 ++++++ src/Effect/Console.purs | 10 ++++++++++ test/Main.purs | 14 ++++++++++++++ test/expected_output.txt | 5 +++++ 9 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 scripts/test create mode 100644 test/Main.purs create mode 100644 test/expected_output.txt diff --git a/.gitignore b/.gitignore index b846b63..5b50308 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /node_modules/ /output/ package-lock.json +test/actual_output.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index c556894..393ec70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Breaking changes: New features: +- Added `debug` (#36) + Bugfixes: Other improvements: diff --git a/package.json b/package.json index 4ea39f9..6b85059 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "private": true, "scripts": { "clean": "rimraf output && rimraf .pulp-cache", - "build": "eslint src && pulp build -- --censor-lib --strict" + "build": "eslint src && pulp build -- --censor-lib --strict", + "test": "npm run build && ./scripts/test" }, "devDependencies": { "eslint": "^7.15.0", diff --git a/scripts/test b/scripts/test new file mode 100755 index 0000000..cd6b2e8 --- /dev/null +++ b/scripts/test @@ -0,0 +1,5 @@ +#!/bin/bash -e + +pulp build -I test +node --input-type=module -e 'import { main } from "./output/Test.Main/index.js"; main();' > test/actual_output.txt 2>&1 +diff -u test/expected_output.txt test/actual_output.txt diff --git a/src/Effect/Class/Console.purs b/src/Effect/Class/Console.purs index 9a198bb..8f22f8e 100644 --- a/src/Effect/Class/Console.purs +++ b/src/Effect/Class/Console.purs @@ -30,6 +30,12 @@ info = liftEffect <<< EffConsole.info infoShow :: forall m a. MonadEffect m => Show a => a -> m Unit infoShow = liftEffect <<< EffConsole.infoShow +debug :: forall m. MonadEffect m => String -> m Unit +debug = liftEffect <<< EffConsole.debug + +debugShow :: forall m a. MonadEffect m => Show a => a -> m Unit +debugShow = liftEffect <<< EffConsole.debugShow + time :: forall m. MonadEffect m => String -> m Unit time = liftEffect <<< EffConsole.time diff --git a/src/Effect/Console.js b/src/Effect/Console.js index fdf4345..b96fed8 100644 --- a/src/Effect/Console.js +++ b/src/Effect/Console.js @@ -22,6 +22,12 @@ export const info = function (s) { }; }; +export const debug = function (s) { + return function () { + console.debug(s); + }; +}; + export const time = function (s) { return function () { console.time(s); diff --git a/src/Effect/Console.purs b/src/Effect/Console.purs index 8a00758..9aec0ed 100644 --- a/src/Effect/Console.purs +++ b/src/Effect/Console.purs @@ -45,6 +45,16 @@ foreign import info infoShow :: forall a. Show a => a -> Effect Unit infoShow a = info (show a) +-- | Write an debug message to the console. +foreign import debug + :: String + -> Effect Unit + +-- | Write an debug value to the console, using its `Show` instance to produce a +-- | `String`. +debugShow :: forall a. Show a => a -> Effect Unit +debugShow a = debug (show a) + -- | Start a named timer. foreign import time :: String -> Effect Unit diff --git a/test/Main.purs b/test/Main.purs new file mode 100644 index 0000000..f4947f1 --- /dev/null +++ b/test/Main.purs @@ -0,0 +1,14 @@ +module Test.Main where + +import Prelude + +import Effect (Effect) +import Effect.Class.Console as Console + +main :: Effect Unit +main = do + Console.log "log" + Console.warn "warn" + Console.error "error" + Console.info "info" + Console.debug "debug" diff --git a/test/expected_output.txt b/test/expected_output.txt new file mode 100644 index 0000000..2c91449 --- /dev/null +++ b/test/expected_output.txt @@ -0,0 +1,5 @@ +log +warn +error +info +debug From eab163f612bb2cd1a2c141beb0b5724cd4d5a157 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Wed, 30 Mar 2022 14:58:20 -0500 Subject: [PATCH 07/10] Remove blank line separating header from entry --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 393ec70..59c44b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,6 @@ Breaking changes: - Migrated FFI to ES modules (#39 by @kl0tl and @JordanMartinez) New features: - - Added `debug` (#36) Bugfixes: From 3b83d7b792d03872afeea5e62b4f686ab0f09842 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Wed, 27 Apr 2022 09:11:24 -0500 Subject: [PATCH 08/10] Prepare v6.0.0 release (1st PS 0.15.0-compatible release) (#40) * Update the bower dependencies * Update Node to 14 in CI * Update the changelog --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 10 ++++++++++ bower.json | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6ebf3a..c69237a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: with: purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14.x" - name: Install dependencies run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 59c44b3..4018d87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v6.0.0](https://github.com/purescript/purescript-console/releases/tag/v6.0.0) - 2022-04-27 + Breaking changes: - Migrated FFI to ES modules (#39 by @kl0tl and @JordanMartinez) diff --git a/bower.json b/bower.json index 483558f..da93c7f 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,7 @@ "package.json" ], "dependencies": { - "purescript-effect": "master", - "purescript-prelude": "master" + "purescript-effect": "^4.0.0", + "purescript-prelude": "^6.0.0" } } From 3a0cf2ee816d9d93063a2c0d07a3e54a635f136b Mon Sep 17 00:00:00 2001 From: Pete Murphy <26548438+pete-murphy@users.noreply.github.com> Date: Sun, 8 Oct 2023 13:06:01 -0400 Subject: [PATCH 09/10] Add group functions (#42) * Add group functions Fixes #41 * Add test * Add to CHANGELOG * Add grouped function --------- Co-authored-by: Peter Murphy <26548438+ptrfrncsmrph@users.noreply.github.com> --- CHANGELOG.md | 1 + src/Effect/Class/Console.purs | 17 +++++++++++++++++ src/Effect/Console.js | 16 ++++++++++++++++ src/Effect/Console.purs | 20 ++++++++++++++++++++ test/Main.purs | 8 ++++++++ test/expected_output.txt | 6 ++++++ 6 files changed, 68 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4018d87..924de61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: +- Added `group`, `groupCollapsed`, and `groupEnd` (#42 by @pete-murphy) Bugfixes: diff --git a/src/Effect/Class/Console.purs b/src/Effect/Class/Console.purs index 8f22f8e..d11db86 100644 --- a/src/Effect/Class/Console.purs +++ b/src/Effect/Class/Console.purs @@ -1,5 +1,6 @@ module Effect.Class.Console where +import Control.Bind (discard, bind, pure) import Data.Function ((<<<)) import Data.Show (class Show) import Data.Unit (Unit) @@ -47,3 +48,19 @@ timeEnd = liftEffect <<< EffConsole.timeEnd clear :: forall m. MonadEffect m => m Unit clear = liftEffect EffConsole.clear + +group :: forall m. MonadEffect m => String -> m Unit +group = liftEffect <<< EffConsole.group + +groupCollapsed :: forall m. MonadEffect m => String -> m Unit +groupCollapsed = liftEffect <<< EffConsole.groupCollapsed + +groupEnd :: forall m. MonadEffect m => m Unit +groupEnd = liftEffect EffConsole.groupEnd + +grouped :: forall m a. MonadEffect m => String -> m a -> m a +grouped name inner = do + group name + result <- inner + groupEnd + pure result diff --git a/src/Effect/Console.js b/src/Effect/Console.js index b96fed8..8db1f20 100644 --- a/src/Effect/Console.js +++ b/src/Effect/Console.js @@ -49,3 +49,19 @@ export const timeEnd = function (s) { export const clear = function () { console.clear(); }; + +export const group = function (s) { + return function () { + console.group(s); + }; +}; + +export const groupCollapsed = function (s) { + return function () { + console.groupCollapsed(s); + }; +}; + +export const groupEnd = function () { + console.groupEnd(); +}; diff --git a/src/Effect/Console.purs b/src/Effect/Console.purs index 9aec0ed..f3d08df 100644 --- a/src/Effect/Console.purs +++ b/src/Effect/Console.purs @@ -1,5 +1,6 @@ module Effect.Console where +import Control.Bind (discard, bind, pure) import Effect (Effect) import Data.Show (class Show, show) @@ -66,3 +67,22 @@ foreign import timeEnd :: String -> Effect Unit -- | Clears the console foreign import clear :: Effect Unit + +-- | Creates a new inline group in the console. This indents following console +-- | messages by an additional level, until `groupEnd` is called. +foreign import group :: String -> Effect Unit + +-- | Same as `group`, but groups are collapsed by default. +foreign import groupCollapsed :: String -> Effect Unit + +-- | Exits the current inline group in the console. +foreign import groupEnd :: Effect Unit + +-- | Perform an effect within the context of an inline group in the console. +-- | Calls `group` and `groupEnd` before and after the effect, respectively. +grouped :: forall a. String -> Effect a -> Effect a +grouped name inner = do + group name + result <- inner + groupEnd + pure result diff --git a/test/Main.purs b/test/Main.purs index f4947f1..fee924f 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -12,3 +12,11 @@ main = do Console.error "error" Console.info "info" Console.debug "debug" + Console.group "group" + Console.log "log in group" + Console.groupCollapsed "groupCollapsed" + Console.log "log in groupCollapsed" + Console.groupEnd + Console.groupEnd + Console.grouped "grouped" do + Console.log "log in grouped" diff --git a/test/expected_output.txt b/test/expected_output.txt index 2c91449..08e6d63 100644 --- a/test/expected_output.txt +++ b/test/expected_output.txt @@ -3,3 +3,9 @@ warn error info debug +group + log in group + groupCollapsed + log in groupCollapsed +grouped + log in grouped From dc9854023e3392399f5eea9f5db965dbfe2cfe11 Mon Sep 17 00:00:00 2001 From: Gary Burgess Date: Sun, 8 Oct 2023 18:07:02 +0100 Subject: [PATCH 10/10] Update CHANGELOG.md --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 924de61..68339cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,16 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: -- Added `group`, `groupCollapsed`, and `groupEnd` (#42 by @pete-murphy) Bugfixes: Other improvements: +## [v6.1.0](https://github.com/purescript/purescript-console/releases/tag/v6.1.0) - 2023-10-08 + +New features: +- Added `group`, `groupCollapsed`, and `groupEnd` (#42 by @pete-murphy) + ## [v6.0.0](https://github.com/purescript/purescript-console/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: