Skip to content

Commit baf78ff

Browse files
authored
Tidying up Data.String (#2061)
1 parent 0661b59 commit baf78ff

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/Data/String.agda

+6-14
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@
88

99
module Data.String where
1010

11-
open import Data.Bool using (true; false; T?)
11+
open import Data.Bool.Base using (if_then_else_)
1212
open import Data.Char as Char using (Char)
13-
open import Function.Base
14-
open import Data.Nat.Base as ℕ using (ℕ; _∸_; ⌊_/2⌋; ⌈_/2⌉)
13+
open import Function.Base using (_∘_; _$_)
14+
open import Data.Nat.Base as ℕ using (ℕ)
1515
import Data.Nat.Properties as ℕₚ
16-
open import Data.List.Base as List using (List; _∷_; []; [_])
17-
open import Data.List.NonEmpty as NE using (List⁺)
16+
open import Data.List.Base as List using (List)
1817
open import Data.List.Extrema ℕₚ.≤-totalOrder
19-
open import Data.List.Relation.Binary.Pointwise.Base using (Pointwise)
20-
open import Data.List.Relation.Binary.Lex.Strict using (Lex-<; Lex-≤)
2118
open import Data.Vec.Base as Vec using (Vec)
2219
open import Data.Char.Base as Char using (Char)
2320
import Data.Char.Properties as Char using (_≟_)
24-
open import Relation.Binary.Core using (Rel)
25-
open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl)
26-
open import Relation.Nullary.Decidable using (does)
27-
open import Relation.Unary using (Pred; Decidable)
21+
open import Relation.Nullary.Decidable.Core using (does)
2822

2923
open import Data.List.Membership.DecPropositional Char._≟_
3024

@@ -48,9 +42,7 @@ fromVec = fromList ∘ Vec.toList
4842

4943
-- enclose string with parens if it contains a space character
5044
parensIfSpace : String String
51-
parensIfSpace s with does (' ' ∈? toList s)
52-
... | true = parens s
53-
... | false = s
45+
parensIfSpace s = if does (' ' ∈? toList s) then parens s else s
5446

5547

5648
------------------------------------------------------------------------

0 commit comments

Comments
 (0)