refactor: move List.takeWhile to Init.Data.List.Basic
Motivation: make sure it will be aligned by BinPort
This commit is contained in:
parent
59dff3f3e0
commit
af5ff9ceb2
2 changed files with 6 additions and 10 deletions
|
|
@ -203,6 +203,12 @@ def take : Nat → List α → List α
|
|||
| n+1, [] => []
|
||||
| n+1, a::as => a :: take n as
|
||||
|
||||
def takeWhile (p : α → Bool) : List α → List α
|
||||
| [] => []
|
||||
| hd :: tl => match p hd with
|
||||
| true => hd :: takeWhile p tl
|
||||
| false => []
|
||||
|
||||
@[specialize] def foldr (f : α → β → β) (init : β) : List α → β
|
||||
| [] => init
|
||||
| a :: l => f a (foldr f init l)
|
||||
|
|
|
|||
|
|
@ -155,15 +155,5 @@ def publishProgressDone (m : DocumentMeta) (hOut : FS.Stream) : IO Unit :=
|
|||
|
||||
end Lean.Server
|
||||
|
||||
namespace List
|
||||
|
||||
universe u
|
||||
|
||||
def takeWhile (p : α → Bool) : List α → List α
|
||||
| [] => []
|
||||
| hd :: tl => if p hd then hd :: takeWhile p tl else []
|
||||
|
||||
end List
|
||||
|
||||
def String.Range.toLspRange (text : Lean.FileMap) (r : String.Range) : Lean.Lsp.Range :=
|
||||
⟨text.utf8PosToLspPos r.start, text.utf8PosToLspPos r.stop⟩
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue