packages feed

exotic-list-monads 1.2.0 → 1.2.1

raw patch · 5 files changed

+42/−29 lines, 5 files

Files

CHANGELOG.md view
@@ -1,5 +1,12 @@ # exotic-list-monad changelog +## v1.2.1++- Add `UndecidableInstances` extension to `Control.Monad.List.NonEmpty.Exotic` to+  deal with the `2 <= n + k` constraint in the `AlphaNOmegaK` monad on newer GHCs++- Turn off the `x-partial` warning+ ## v1.2.0  - Add the `AlphaNOmegaK` monad
README.md view
@@ -1,5 +1,13 @@ # exotic-list-monads +A Haskell library with non-standard monads on lists and non-empty lists++- Monads on lists: [Control.Monad.List.Exotic](https://hackage.haskell.org/package/exotic-list-monads-1.1.0/docs/Control-Monad-List-Exotic.html)++- Monads on non-empty lists: [Control.Monad.List.NonEmpty.Exotic](https://hackage.haskell.org/package/exotic-list-monads-1.1.0/docs/Control-Monad-List-NonEmpty-Exotic.html)++## Description+ The usual [list monad](https://hackage.haskell.org/package/base-4.14.0.0/docs/src/GHC.Base.html#line-1133) is only one of infinitely many ways to turn the list functor into a monad. The same applies to the usual [non-empty list monad](https://hackage.haskell.org/package/base-4.14.0.0/docs/src/GHC.Base.html#line-1105) and the non-empty list functor. This library collects such non-standard "list" and "non-empty list" monads.  It is quite possible that there exist "list" and "non-empty list" monads that we are not aware of, so pull requests are appreciated. Moreover, not every monad in this library has been formally verified to be a monad (it is not a trivial task because of combinatorial explosions of the number of cases to be considered in some proofs of associativity), so if you're currently playing around with tools like Coq and have a spare afternoon...
exotic-list-monads.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           exotic-list-monads-version:        1.2.0+version:        1.2.1 synopsis:       Non-standard monads on lists and non-empty lists description:    The usual list monad is only one of infinitely many ways to turn the list functor into a monad. The same applies to the usual non-empty list monad and the non-empty list functor. This library collects such non-standard "list" and "non-empty list" monads. category:       List, Monads@@ -18,7 +18,7 @@ license-file:   LICENSE build-type:     Simple tested-with:-    GHC ==9.4.8+    GHC ==9.8.4 extra-source-files:     README.md     CHANGELOG.md@@ -36,7 +36,7 @@       Paths_exotic_list_monads   hs-source-dirs:       src-  ghc-options: -Wall -Wno-name-shadowing -fno-warn-partial-type-signatures+  ghc-options: -Wall -Wno-name-shadowing -Wno-x-partial -fno-warn-partial-type-signatures   build-depends:       base >=4.9 && <5   default-language: Haskell2010@@ -50,7 +50,7 @@       Paths_exotic_list_monads   hs-source-dirs:       test-  ghc-options: -Wall -Wno-name-shadowing -fno-warn-partial-type-signatures+  ghc-options: -Wall -Wno-name-shadowing -Wno-x-partial -fno-warn-partial-type-signatures   build-depends:       QuickCheck     , base >=4.9 && <5
src/Control/Monad/List/Exotic.hs view
@@ -7,7 +7,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ViewPatterns #-}-{-# LANGUAGE MultiParamTypeClasses #-}+-- {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-}@@ -26,7 +26,7 @@ -- | -- Module      : Control.Monad.List.Exotic -- Description : Non-standard monads on the list functor--- Copyright   : (c) Dylan McDermott, Maciej Piróg, Tarmo Uustalu, 2020+-- Copyright   : (c) 2020-2025 Dylan McDermott, Maciej Piróg, Tarmo Uustalu -- License     : MIT -- Maintainer  : maciej.adam.pirog@gmail.com -- Stability   : experimental@@ -377,7 +377,7 @@ instance ListMonad GlobalFailure  instance PointedMagma (GlobalFailure a) where-  m <> t = join $ GlobalFailure $ [m, t]+  m <> t = join $ GlobalFailure [m, t]   eps    = GlobalFailure []  instance ZeroSemigroup (GlobalFailure a)@@ -473,7 +473,7 @@ instance ListMonad MazeWalk  instance PointedMagma (MazeWalk a) where-  m <> t = join $ MazeWalk $ [m, t]+  m <> t = join $ MazeWalk [m, t]   eps    = MazeWalk []  instance PalindromeAlgebra (MazeWalk a)@@ -543,7 +543,7 @@ instance ListMonad DiscreteHybrid  instance PointedMagma (DiscreteHybrid a) where-  m <> t = join $ DiscreteHybrid $ [m, t]+  m <> t = join $ DiscreteHybrid [m, t]   eps    = DiscreteHybrid []  instance LeaningAlgebra (DiscreteHybrid a)@@ -614,7 +614,7 @@ instance ListMonad ListUnfold  instance PointedMagma (ListUnfold a) where-  m <> t = join $ ListUnfold $ [m, t]+  m <> t = join $ ListUnfold [m, t]   eps    = ListUnfold []  instance SkewedAlgebra (ListUnfold a)@@ -703,7 +703,7 @@ instance (KnownNat n) => ListMonad (Stutter n)   instance (KnownNat n) => PointedMagma (Stutter n a) where-  m <> t = join $ Stutter $ [m, t]+  m <> t = join $ Stutter [m, t]   eps    = Stutter []  instance (KnownNat n) => StutterAlgebra n (Stutter n a)@@ -778,7 +778,7 @@ instance (KnownNat n) => ListMonad (StutterKeeper n)   instance (KnownNat n) => PointedMagma (StutterKeeper n a) where-  m <> t = join $ StutterKeeper $ [m, t]+  m <> t = join $ StutterKeeper [m, t]   eps    = StutterKeeper []  instance (KnownNat n) => StutterKeeperAlgebra n (StutterKeeper n a)@@ -859,7 +859,7 @@ instance (KnownNat n, KnownNat m) => ListMonad (StutterStutter n m)   instance (KnownNat n, KnownNat m) => PointedMagma (StutterStutter n m a) where-  m <> t = join $ StutterStutter $ [m, t]+  m <> t = join $ StutterStutter [m, t]   eps    = StutterStutter []  instance (KnownNat n, KnownNat m)
src/Control/Monad/List/NonEmpty/Exotic.hs view
@@ -2,12 +2,10 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ViewPatterns #-}-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-}@@ -15,14 +13,14 @@ {-# LANGUAGE PartialTypeSignatures #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE OverloadedLists #-}-+{-# LANGUAGE UndecidableInstances #-} -- needed for the 2 < n + k constraint in AlphaNOmegaK  -- {-# LANGUAGE OverloadedStrings #-}  -- | -- Module      : Control.Monad.List.NonEmpty.Exotic -- Description : Non-standard monads on the non-empty list functor--- Copyright   : (c) Dylan McDermott, Maciej Piróg, Tarmo Uustalu, 2020+-- Copyright   : (c) 2020-2025 Dylan McDermott, Maciej Piróg, Tarmo Uustalu -- License     : MIT -- Maintainer  : maciej.adam.pirog@gmail.com -- Stability   : experimental@@ -327,7 +325,7 @@  deriving (Functor, Show, Eq)  instance Applicative Keeper where-  pure a = Keeper $ [a]  -- OverloadedLists+  pure a = Keeper [a]  -- OverloadedLists   (<*>)  = ap  instance Monad Keeper where@@ -346,7 +344,7 @@ instance NonEmptyMonad Keeper  instance Magma (Keeper a) where-  m <> t = join $ Keeper $ [m, t]+  m <> t = join $ Keeper [m, t]  instance XY (Keeper a) @@ -387,7 +385,7 @@  deriving (Functor, Show, Eq)  instance Applicative DiscreteHybridNE where-  pure a = DiscreteHybridNE $ [a]  -- OverloadedLists+  pure a = DiscreteHybridNE [a]  -- OverloadedLists   (<*>)  = ap  instance Monad DiscreteHybridNE where@@ -404,7 +402,7 @@ instance NonEmptyMonad DiscreteHybridNE  instance Magma (DiscreteHybridNE a) where-  m <> t = join $ DiscreteHybridNE $ [m, t]+  m <> t = join $ DiscreteHybridNE [m, t]  instance YZ (DiscreteHybridNE a) @@ -445,7 +443,7 @@  deriving (Functor, Show, Eq)  instance Applicative OpDiscreteHybridNE where-  pure a = OpDiscreteHybridNE $ [a]  -- OverloadedLists+  pure a = OpDiscreteHybridNE [a]  -- OverloadedLists   (<*>)  = ap  instance Monad OpDiscreteHybridNE where@@ -462,7 +460,7 @@ instance NonEmptyMonad OpDiscreteHybridNE  instance Magma (OpDiscreteHybridNE a) where-  m <> t = join $ OpDiscreteHybridNE $ [m, t]+  m <> t = join $ OpDiscreteHybridNE [m, t]  instance XZ (OpDiscreteHybridNE a) @@ -504,7 +502,7 @@  deriving (Functor, Show, Eq)  instance Applicative MazeWalkNE where-  pure a = MazeWalkNE $ [a]  -- OverloadedLists+  pure a = MazeWalkNE [a]  -- OverloadedLists   (<*>)  = ap  instance Monad MazeWalkNE where@@ -523,7 +521,7 @@ instance NonEmptyMonad MazeWalkNE  instance Magma (MazeWalkNE a) where-  m <> t = join $ MazeWalkNE $ [m, t]+  m <> t = join $ MazeWalkNE [m, t]  instance PalindromeMagma (MazeWalkNE a) @@ -563,7 +561,7 @@  deriving (Functor, Show, Eq)  instance (KnownNat n) => Applicative (StutterNE n) where-  pure a = StutterNE $ [a]  -- OverloadedLists+  pure a = StutterNE [a]  -- OverloadedLists   (<*>)  = ap  instance (KnownNat n) => Monad (StutterNE n) where@@ -589,7 +587,7 @@ instance (KnownNat n) => NonEmptyMonad (StutterNE n)  instance (KnownNat n) => Magma (StutterNE n a) where-  m <> t = join $ StutterNE $ [m, t]+  m <> t = join $ StutterNE [m, t]  instance (KnownNat n) => StutterMagma n (StutterNE n a) @@ -668,7 +666,7 @@  deriving (Functor, Show, Eq)  instance Applicative HeadTails where-  pure a = HeadTails $ [a,a]  -- OverloadedLists+  pure a = HeadTails [a,a]  -- OverloadedLists   (<*>)  = ap  instance Monad HeadTails where@@ -772,7 +770,7 @@  deriving (Functor, Show, Eq)  instance Applicative HeadsTail where-  pure a = HeadsTail $ [a,a]  -- OverloadedLists+  pure a = HeadsTail [a,a]  -- OverloadedLists   (<*>)  = ap  instance Monad HeadsTail where