File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 11module SExp where
22
33open import Level using (0ℓ)
4- open import Level.Bounded using (theSet; [_] )
4+ open import Level.Bounded using (theSet)
55open import Data.Char.Base
66open import Data.String.Base as String using (String)
77
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ private
2626
2727-- We re-export all of the combinators someone may need, specialised to CHARS
2828
29+ open Level≤ using ([_]) public
2930open import Text.Parser.Types P hiding (runParser) public
3031open import Text.Parser.Combinators {P = P} public
3132open import Text.Parser.Combinators.Numbers {P = P} public
Original file line number Diff line number Diff line change @@ -14,8 +14,10 @@ open import Data.Bool.Base as Bool using (Bool; if_then_else_; not; _∧_)
1414open import Data.List.Base as List using (_∷_; []; null)
1515open import Data.List.NonEmpty as List⁺ using (_∷⁺_ ; _∷_)
1616open import Data.Maybe.Base using (just; nothing; maybe)
17+ open import Data.Nat.Base using (suc; NonZero)
1718open import Data.Product as Product using (_,_; proj₁; proj₂; uncurry)
1819open import Data.Sum.Base as Sum using (inj₁; inj₂)
20+ open import Data.Vec.Base as Vec using (_∷_; [])
1921
2022open import Data.Nat.Properties as Nat using (≤-refl; ≤-trans; <⇒≤; <-trans)
2123import Data.List.Relation.Unary.Any as Any
@@ -275,3 +277,7 @@ module _ {{𝕊 : Sized Tok Toks}} {{𝕄 : RawMonadPlus M}}
275277 list⁺ = Box.fix (Parser A ⇒ Parser (List⁺ A)) $ λ rec pA →
276278 uncurry (λ hd → (hd ∷_) ∘′ maybe List⁺.toList [])
277279 <$> (pA <&?> (Box.app rec (box pA)))
280+
281+ replicate : (n : ℕ) → {NonZero n} → ∀[ Parser A ⇒ Parser (Vec A n) ]
282+ replicate 1 p = Vec.[_] <$> p
283+ replicate (suc n@(suc _)) p = uncurry Vec._∷_ <$> (p <&> box (replicate n p))
You can’t perform that action at this time.
0 commit comments