Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ Non-backwards compatible changes
their definitions and signatures updated to use `IsMagmaHomomorphism` and
`IsMonoidHomomorphism` respectively

* In `Data.List.Base`: the function definition `[_]` has been turned into
a `pattern` synonym, with a companion function definition `pure` instead.

* In `Data.List.DifferenceList.Base`: `take` and `drop` are deprecated
because they do not have a lawful relationship to their `Data.List`
counterparts. Consider using `viaList` if you want a lawful lifting
Expand Down
6 changes: 4 additions & 2 deletions src/Data/List/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ private
open import Agda.Builtin.List public
using (List; []; _∷_)

pattern [_] x = x ∷ []

------------------------------------------------------------------------
-- Operations for transforming lists

Expand Down Expand Up @@ -156,8 +158,8 @@ length = foldr (const suc) 0
------------------------------------------------------------------------
-- Operations for constructing lists

[_] : A → List A
[ x ] = x ∷ []
pure : A → List A

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would much prefer singleton.

pure = [_]

fromMaybe : Maybe A → List A
fromMaybe (just x) = [ x ]
Expand Down
6 changes: 3 additions & 3 deletions src/Data/List/Effectful.agda
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
module Data.List.Effectful where

open import Data.Bool.Base using (false; true)
open import Data.List.Base
using (List; map; [_]; ap; []; _∷_; _++_; concat; concatMap)
open import Data.List.Base as List
using (List; map; ap; []; _∷_; _++_; concat; concatMap)
open import Data.List.Properties
using (++-identityʳ; ++-assoc; map-cong; concatMap-cong; map-concatMap
; concatMap-pure)
Expand Down Expand Up @@ -43,7 +43,7 @@ functor = record { _<$>_ = map }
applicative : RawApplicative {ℓ} List
applicative = record
{ rawFunctor = functor
; pure = [_]
; pure = List.pure
; _<*>_ = ap
}

Expand Down
2 changes: 1 addition & 1 deletion src/Data/List/Relation/Unary/Any/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open import Data.Bool.ListAction using (any)
open import Data.Bool.Properties using (T-∨; T-≡)
open import Data.Empty using (⊥)
open import Data.Fin.Base using (Fin; zero; suc)
open import Data.List.Base as List hiding (find; and; or; all; any)
open import Data.List.Base as List hiding (find; and; or; all; any; pure)
open import Data.List.Effectful as List using (monad)
open import Data.List.Relation.Unary.Any as Any using (Any; here; there)
open import Data.List.Membership.Propositional
Expand Down
2 changes: 1 addition & 1 deletion src/IO.agda
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module Colist where

module List where

open import Data.List.Base
open import Data.List.Base hiding (pure)

sequence : List (IO A) IO (List A)
sequence [] = ⦇ [] ⦈
Expand Down
2 changes: 1 addition & 1 deletion src/Text/Format/Generic.agda
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Text.Format.Generic where
open import Level using (0ℓ)
open import Effect.Applicative
open import Data.Char.Base using (Char)
open import Data.List.Base as List hiding (sum)
open import Data.List.Base as List hiding (sum; pure)
open import Data.Maybe.Base as Maybe
open import Data.Nat.Base
open import Data.Nat.ListAction using (sum)
Expand Down
Loading