packages feed

morley-prelude 0.4.1 → 0.4.2

raw patch · 4 files changed

+55/−7 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Prelude: (&&) :: Bool -> Bool -> Bool
- Prelude: (||) :: Bool -> Bool -> Bool
+ Morley.Prelude.Boolean: (&&) :: Boolean a => a -> a -> a
+ Morley.Prelude.Boolean: (||) :: Boolean a => a -> a -> a
+ Morley.Prelude.Boolean: ApplicativeBoolean :: f bool -> ApplicativeBoolean f bool
+ Morley.Prelude.Boolean: class Boolean a
+ Morley.Prelude.Boolean: infixr 2 ||
+ Morley.Prelude.Boolean: infixr 3 &&
+ Morley.Prelude.Boolean: instance (GHC.Base.Applicative f, Morley.Prelude.Boolean.Boolean bool) => Morley.Prelude.Boolean.Boolean (Morley.Prelude.Boolean.ApplicativeBoolean f bool)
+ Morley.Prelude.Boolean: instance GHC.Base.Applicative f => GHC.Base.Applicative (Morley.Prelude.Boolean.ApplicativeBoolean f)
+ Morley.Prelude.Boolean: instance GHC.Base.Functor f => GHC.Base.Functor (Morley.Prelude.Boolean.ApplicativeBoolean f)
+ Morley.Prelude.Boolean: instance Morley.Prelude.Boolean.Boolean GHC.Types.Bool
+ Morley.Prelude.Boolean: instance Morley.Prelude.Boolean.Boolean bool => Morley.Prelude.Boolean.Boolean (GHC.Types.IO bool)
+ Morley.Prelude.Boolean: instance Morley.Prelude.Boolean.Boolean bool => Morley.Prelude.Boolean.Boolean (a -> bool)
+ Morley.Prelude.Boolean: newtype ApplicativeBoolean f bool
- Prelude: infixr 3 &&
+ Prelude: infixr 3 &&&

Files

CHANGES.md view
@@ -2,9 +2,14 @@ ========== <!-- Append new entries here --> -0.4.1+0.4.2 =====+* [!867](https://gitlab.com/morley-framework/morley/-/merge_requests/867)+  + Hid Prelude's `&&` and `||` operators+  + Exported `Boolean` typeclass and polymorphic `&&` and `||` operators. +0.4.1+===== * [!861](https://gitlab.com/morley-framework/morley/-/merge_requests/861)   + Removed the re-export of some basic `microlens` operators from `universum`     in favor of the ones from `lens` with the same name.
morley-prelude.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           morley-prelude-version:        0.4.1+version:        0.4.2 synopsis:       A custom prelude used in Morley description:    A custom prelude used in Morley. It re-exports the Universum prelude and makes some tiny changes. category:       Prelude@@ -26,6 +26,7 @@  library   exposed-modules:+      Morley.Prelude.Boolean       Prelude       Unsafe   other-modules:
+ src/Morley/Prelude/Boolean.hs view
@@ -0,0 +1,38 @@+-- SPDX-FileCopyrightText: 2021 Tocqueville Group+--+-- SPDX-License-Identifier: LicenseRef-MIT-TQ++{-# LANGUAGE NoImplicitPrelude #-}++-- | This module replaces the monomorphic boolean operators from 'Prelude'+-- with a set of polymorphic operators.+module Morley.Prelude.Boolean+  ( Boolean(..)+  , ApplicativeBoolean(..)+  ) where++import Universum hiding ((&&), (||))+import qualified Universum++-- | Generalized boolean operators.+class Boolean a where+  (&&) :: a -> a -> a+  (||) :: a -> a -> a+  infixr 3 &&+  infixr 2 ||++instance Boolean Bool where+  (&&) = (Universum.&&)+  (||) = (Universum.||)++-- | A newtype for deriving a 'Boolean' instance for any 'Applicative' type+-- constructor using @DerivingVia@.+newtype ApplicativeBoolean f bool = ApplicativeBoolean (f bool)+  deriving newtype (Functor, Applicative)++instance (Applicative f, Boolean bool) => Boolean (ApplicativeBoolean f bool) where+  (&&) = liftA2 (&&)+  (||) = liftA2 (||)++deriving via (ApplicativeBoolean IO bool) instance Boolean bool => Boolean (IO bool)+deriving via (ApplicativeBoolean ((->) a) bool) instance Boolean bool => Boolean (a -> bool)
src/Prelude.hs view
@@ -10,11 +10,15 @@   ( module Control.Lens   , module Universum   , for+  -- * Overloaded boolean operators+  , module Boolean   ) where -import Control.Lens (Lens, Lens', Traversal, Traversal', over, set, (%~), (&), (.~), (<&>), (^.),-                    (^..), (^?), _1, _2, _3, _4, _5, preuse, preview, use, view)+import Control.Lens+  (Lens, Lens', Traversal, Traversal', _1, _2, _3, _4, _5, over, preuse, preview, set, use, view,+  (%~), (&), (.~), (<&>), (^.), (^..), (^?)) import Data.Traversable (for)-import Universum hiding (Key, Nat, Val, readFile, writeFile, Lens, Lens', Traversal, Traversal',-                         over, set, (%~), (&), (.~), (<&>), (^.), (^..), (^?), _1, _2, _3, _4, _5,-                         preuse, preview, use, view)+import Morley.Prelude.Boolean as Boolean+import Universum hiding+  (Key, Lens, Lens', Nat, Traversal, Traversal', Val, _1, _2, _3, _4, _5, over, preuse, preview,+  readFile, set, use, view, writeFile, (%~), (&&), (&), (.~), (<&>), (^.), (^..), (^?), (||))