File: .lake/packages/batteries/Batteries/Data/MLList/Basic.lean

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec.nil
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: self.listM α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec.thunk
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: (Unit → self.listM α) → self.listM α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec.uncons?
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: self.listM α → Option (Option (α × self.listM α))

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec.cons
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: α → self.listM α → self.listM α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: Type (u + 1)

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec.squash
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: (Unit → m (self.listM α)) → self.listM α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec.listM
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: Type u → Type u

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.Spec.uncons
code: private structure Spec (m : Type u → Type u) where
  listM : Type u → Type u
  nil : listM α
  cons : α → listM α → listM α
  thunk : (Unit → listM α) → listM α
  squash : (Unit → m (listM α)) → listM α
  uncons : [Monad m] → listM α → m (Option (α × listM α))
  uncons? : listM α → Option (Option (α × listM α))
goal: self.listM α → m (Option (α × self.listM α))

full_name: MLList.instNonemptySpec
code: instance : Nonempty (Spec m) 
goal: Nonempty (MLList.Spec m)

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.MLListImpl
code: private unsafe inductive MLListImpl (m : Type u → Type u) (α : Type u) : Type u
  | nil : MLListImpl m α
  | cons : α → MLListImpl m α → MLListImpl m α
  | thunk : Thunk (MLListImpl m α) → MLListImpl m α
  | squash : (Unit → m (MLListImpl m α)) → MLListImpl m α
goal: Type u

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.MLListImpl.nil
code: private unsafe inductive MLListImpl (m : Type u → Type u) (α : Type u) : Type u
  | nil : MLListImpl m α
  | cons : α → MLListImpl m α → MLListImpl m α
  | thunk : Thunk (MLListImpl m α) → MLListImpl m α
  | squash : (Unit → m (MLListImpl m α)) → MLListImpl m α
goal: MLList.MLListImpl m α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.MLListImpl.squash
code: private unsafe inductive MLListImpl (m : Type u → Type u) (α : Type u) : Type u
  | nil : MLListImpl m α
  | cons : α → MLListImpl m α → MLListImpl m α
  | thunk : Thunk (MLListImpl m α) → MLListImpl m α
  | squash : (Unit → m (MLListImpl m α)) → MLListImpl m α
goal: (Unit → m (MLList.MLListImpl m α)) → MLList.MLListImpl m α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.MLListImpl.thunk
code: private unsafe inductive MLListImpl (m : Type u → Type u) (α : Type u) : Type u
  | nil : MLListImpl m α
  | cons : α → MLListImpl m α → MLListImpl m α
  | thunk : Thunk (MLListImpl m α) → MLListImpl m α
  | squash : (Unit → m (MLListImpl m α)) → MLListImpl m α
goal: Thunk (MLList.MLListImpl m α) → MLList.MLListImpl m α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.MLListImpl.cons
code: private unsafe inductive MLListImpl (m : Type u → Type u) (α : Type u) : Type u
  | nil : MLListImpl m α
  | cons : α → MLListImpl m α → MLListImpl m α
  | thunk : Thunk (MLListImpl m α) → MLListImpl m α
  | squash : (Unit → m (MLListImpl m α)) → MLListImpl m α
goal: α → MLList.MLListImpl m α → MLList.MLListImpl m α

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.unconsImpl
code: private unsafe def unconsImpl {m : Type u → Type u} [Monad m] :
    MLListImpl m α → m (Option (α × MLListImpl m α))
  
goal: MLList.MLListImpl m α → m (Option (α × MLList.MLListImpl m α))

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.uncons?Impl
code: private unsafe def uncons?Impl : MLListImpl m α → Option (Option (α × MLListImpl m α))
  
goal: MLList.MLListImpl m α → Option (Option (α × MLList.MLListImpl m α))

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.specImpl
code: @[inline] private unsafe def specImpl (m) : Spec m 
goal: MLList.Spec m

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.spec
code: @[implemented_by specImpl]
private opaque spec (m) : MLList.Spec m
goal: MLList.Spec m

full_name: MLList
code: /-- A monadic lazy list, controlled by an arbitrary monad. -/
def MLList (m : Type u → Type u) (α : Type u) : Type u 
goal: Type u

full_name: MLList.nil
code: /-- The empty `MLList`. -/
@[inline] def nil : MLList m α 
goal: MLList m α

full_name: MLList.cons
code: /--
Constructs a `MLList` from head and tail.
-/
@[inline] def cons : α → MLList m α → MLList m α 
goal: α → MLList m α → MLList m α

full_name: MLList.thunk
code: /-- Embed a non-monadic thunk as a lazy list. -/
@[inline] def thunk : (Unit → MLList m α) → MLList m α 
goal: (Unit → MLList m α) → MLList m α

full_name: MLList.squash
code: /-- Lift a monadic lazy list inside the monad to a monadic lazy list. -/
def squash : (Unit → m (MLList m α)) → MLList m α 
goal: (Unit → m (MLList m α)) → MLList m α

full_name: MLList.uncons
code: /-- Deconstruct a `MLList`, returning inside the monad an optional pair `α × MLList m α`
representing the head and tail of the list. -/
@[inline] def uncons [Monad m] : MLList.{u} m α → m (Option (α × MLList m α)) 
goal: MLList m α → m (Option (α × MLList m α))

full_name: MLList.uncons?
code: /-- Try to deconstruct a `MLList`, returning an optional pair `α × MLList m α`
representing the head and tail of the list if it is already evaluated, and `none` otherwise. -/
@[inline] def uncons? : MLList.{u} m α → Option (Option (α × MLList m α)) 
goal: MLList m α → Option (Option (α × MLList m α))

full_name: MLList.instEmptyCollection
code: instance : EmptyCollection (MLList m α) 
goal: EmptyCollection (MLList m α)

full_name: MLList.instInhabited
code: instance : Inhabited (MLList m α) 
goal: Inhabited (MLList m α)

full_name: _private.«.lake».packages.batteries.Batteries.Data.MLList.Basic.0.MLList.instInhabitedForallForallForallForallForInStepOfMonad
code: private local instance [Monad n] : Inhabited (δ → (α → δ → n (ForInStep δ)) → n δ) 
goal: Inhabited (δ → (α → δ → n (ForInStep δ)) → n δ)

full_name: MLList.forIn
code: /-- The implementation of `ForIn`, which enables `for a in L do ...` notation. -/
@[specialize] protected partial def forIn [Monad m] [Monad n] [MonadLiftT m n]
    (as : MLList m α) (init : δ) (f : α → δ → n (ForInStep δ)) : n δ 
goal: n δ

full_name: MLList.instForInOfMonadOfMonadLiftT
code: instance [Monad m] [MonadLiftT m n] : ForIn n (MLList m α) α 
goal: ForIn n (MLList m α) α

full_name: MLList.singletonM
code: /-- Construct a singleton monadic lazy list from a single monadic value. -/
def singletonM [Monad m] (x : m α) : MLList m α 
goal: MLList m α

full_name: MLList.singleton
code: /-- Construct a singleton monadic lazy list from a single value. -/
def singleton [Monad m] (x : α) : MLList m α 
goal: MLList m α

full_name: MLList.fix
code: /-- Construct a `MLList` recursively. Failures from `f` will result in `uncons` failing.  -/
partial def fix [Monad m] (f : α → m α) (x : α) : MLList m α 
goal: MLList m α

full_name: MLList.fix?'
code: /--
Constructs an `MLList` recursively, with state in `α`, recording terms from `β`.
If `f` returns `none` the list will terminate.

Variant of `MLList.fix?` that allows returning values of a different type.
-/
partial def fix?' [Monad m] (f : α → m (Option (β × α))) (init : α) : MLList m β 
goal: MLList m β

full_name: MLList.fix?
code: /--
Constructs an `MLList` recursively. If `f` returns `none` the list will terminate.

Returns the initial value as the first element.
-/
partial def fix? [Monad m] (f : α → m (Option α)) (x : α) : MLList m α 
goal: MLList m α

full_name: MLList.iterate
code: /-- Construct a `MLList` by iteration. (`m` must be a stateful monad for this to be useful.) -/
partial def iterate [Monad m] (f : m α) : MLList m α 
goal: MLList m α

full_name: MLList.fixlWith
code: /-- Repeatedly apply a function `f : α → m (α × List β)` to an initial `a : α`,
accumulating the elements of the resulting `List β` as a single monadic lazy list.

(This variant allows starting with a specified `List β` of elements, as well. )-/
partial def fixlWith [Monad m] {α β : Type u} (f : α → m (α × List β))
    (s : α) (l : List β) : MLList m β 
goal: MLList m β

full_name: MLList.fixl
code: /-- Repeatedly apply a function `f : α → m (α × List β)` to an initial `a : α`,
accumulating the elements of the resulting `List β` as a single monadic lazy list. -/
def fixl [Monad m] {α β : Type u} (f : α → m (α × List β)) (s : α) : MLList m β 
goal: MLList m β

full_name: MLList.isEmpty
code: /-- Compute, inside the monad, whether a `MLList` is empty. -/
def isEmpty [Monad m] (xs : MLList m α) : m (ULift Bool) 
goal: m (ULift Bool)

full_name: MLList.ofList
code: /-- Convert a `List` to a `MLList`. -/
def ofList : List α → MLList m α
  
goal: List α → MLList m α

full_name: MLList.ofListM
code: /-- Convert a `List` of values inside the monad into a `MLList`. -/
def ofListM [Monad m] : List (m α) → MLList m α
  
goal: List (m α) → MLList m α

full_name: MLList.force
code: /-- Extract a list inside the monad from a `MLList`. -/
partial def force [Monad m] (L : MLList m α) : m (List α) 
goal: m (List α)

full_name: MLList.asArray
code: /-- Extract an array inside the monad from a `MLList`. -/
def asArray [Monad m] (L : MLList m α) : m (Array α) 
goal: m (Array α)

full_name: MLList.casesM
code: /-- Performs a monadic case distinction on a `MLList` when the motive is a `MLList` as well. -/
@[specialize]
def casesM [Monad m] (xs : MLList m α)
    (hnil : Unit → m (MLList m β)) (hcons : α → MLList m α → m (MLList m β)) : MLList m β 
goal: MLList m β

full_name: MLList.cases
code: /--
Performs a case distinction on a `MLList` when the motive is a `MLList` as well.
(We need to be in a monadic context to distinguish a nil from a cons.)
-/
@[specialize]
def cases [Monad m] (xs : MLList m α)
    (hnil : Unit → MLList m β) (hcons : α → MLList m α → MLList m β) : MLList m β 
goal: MLList m β

full_name: MLList.foldsM
code: /-- Gives the monadic lazy list consisting all of folds of a function on a given initial element.
Thus `[a₀, a₁, ...].foldsM f b` will give `[b, ← f b a₀, ← f (← f b a₀) a₁, ...]`. -/
partial def foldsM [Monad m] (f : β → α → m β) (init : β) (L : MLList m α) : MLList m β 
goal: MLList m β

full_name: MLList.folds
code: /-- Gives the monadic lazy list consisting all of folds of a function on a given initial element.
Thus `[a₀, a₁, ...].foldsM f b` will give `[b, f b a₀, f (f b a₀) a₁, ...]`. -/
def folds [Monad m] (f : β → α → β) (init : β) (L : MLList m α) : MLList m β 
goal: MLList m β

full_name: MLList.takeAsList
code: /-- Take the first `n` elements, as a list inside the monad. -/
partial def takeAsList [Monad m] (xs : MLList m α) (n : Nat) : m (List α) 
goal: m (List α)

full_name: MLList.takeAsList.go
code: /-- Take the first `n` elements, as a list inside the monad. -/
partial def takeAsList [Monad m] (xs : MLList m α) (n : Nat) : m (List α) 
goal: m (List α)

full_name: MLList.takeAsArray
code: /-- Take the first `n` elements, as an array inside the monad. -/
partial def takeAsArray [Monad m] (xs : MLList m α) (n : Nat) : m (Array α) 
goal: m (Array α)

full_name: MLList.takeAsArray.go
code: /-- Take the first `n` elements, as an array inside the monad. -/
partial def takeAsArray [Monad m] (xs : MLList m α) (n : Nat) : m (Array α) 
goal: m (Array α)

full_name: MLList.take
code: /-- Take the first `n` elements. -/
partial def take [Monad m] (xs : MLList m α) : Nat → MLList m α
  
goal: Nat → MLList m α

full_name: MLList.drop
code: /-- Drop the first `n` elements. -/
def drop [Monad m] (xs : MLList m α) : Nat → MLList m α
  
goal: Nat → MLList m α

full_name: MLList.mapM
code: /-- Apply a function which returns values in the monad to every element of a `MLList`. -/
partial def mapM [Monad m] (f : α → m β) (xs : MLList m α) : MLList m β 
goal: MLList m β

full_name: MLList.map
code: /-- Apply a function to every element of a `MLList`. -/
def map [Monad m] (f : α → β) (L : MLList m α) : MLList m β 
goal: MLList m β

full_name: MLList.filterM
code: /-- Filter a `MLList` using a monadic function. -/
partial def filterM [Monad m] (p : α → m (ULift Bool)) (L : MLList m α) : MLList m α 
goal: MLList m α

full_name: MLList.filter
code: /-- Filter a `MLList`. -/
def filter [Monad m] (p : α → Bool) (L : MLList m α) : MLList m α 
goal: MLList m α

full_name: MLList.filterMapM
code: /-- Filter and transform a `MLList` using a function that returns values inside the monad. -/
-- Note that the type signature has changed since Lean 3, when we allowed `f` to fail.
-- Use `try?` from `Mathlib.Control.Basic` to lift a possibly failing function to `Option`.
partial def filterMapM [Monad m] (f : α → m (Option β)) (xs : MLList m α) : MLList m β 
goal: MLList m β

full_name: MLList.filterMap
code: /-- Filter and transform a `MLList` using an `Option` valued function. -/
def filterMap [Monad m] (f : α → Option β) : MLList m α → MLList m β 
goal: MLList m α → MLList m β

full_name: MLList.takeWhileM
code: /-- Take the initial segment of the lazy list, until the function `f` first returns `false`. -/
partial def takeWhileM [Monad m] (f : α → m (ULift Bool)) (L : MLList m α) : MLList m α 
goal: MLList m α

full_name: MLList.takeWhile
code: /-- Take the initial segment of the lazy list, until the function `f` first returns `false`. -/
def takeWhile [Monad m] (f : α → Bool) : MLList m α → MLList m α 
goal: MLList m α → MLList m α

full_name: MLList.append
code: /-- Concatenate two monadic lazy lists. -/
partial def append [Monad m] (xs : MLList m α) (ys : Unit → MLList m α) : MLList m α 
goal: MLList m α

full_name: MLList.join
code: /-- Join a monadic lazy list of monadic lazy lists into a single monadic lazy list. -/
partial def join [Monad m] (xs : MLList m (MLList m α)) : MLList m α 
goal: MLList m α

full_name: MLList.enumFrom
code: /-- Enumerate the elements of a monadic lazy list, starting at a specified offset. -/
partial def enumFrom [Monad m] (n : Nat) (xs : MLList m α) : MLList m (Nat × α) 
goal: MLList m (Nat × α)

full_name: MLList.enum
code: /-- Enumerate the elements of a monadic lazy list. -/
def enum [Monad m] : MLList m α → MLList m (Nat × α) 
goal: MLList m α → MLList m (Nat × α)

full_name: MLList.range
code: /-- The infinite monadic lazy list of natural numbers.-/
def range [Monad m] : MLList m Nat 
goal: MLList m Nat

full_name: MLList.fin
code: /-- Iterate through the elements of `Fin n`. -/
partial def fin (n : Nat) : MLList m (Fin n) 
goal: MLList m (Fin n)

full_name: MLList.fin.go
code: /-- Iterate through the elements of `Fin n`. -/
partial def fin (n : Nat) : MLList m (Fin n) 
goal: MLList m (Fin n)

full_name: MLList.ofArray
code: /-- Convert an array to a monadic lazy list. -/
partial def ofArray {α : Type} (L : Array α) : MLList m α 
goal: MLList m α

full_name: MLList.ofArray.go
code: /-- Convert an array to a monadic lazy list. -/
partial def ofArray {α : Type} (L : Array α) : MLList m α 
goal: MLList m α

full_name: MLList.chunk
code: /-- Group the elements of a lazy list into chunks of a given size.
If the lazy list is finite, the last chunk may be smaller (possibly even length 0). -/
partial def chunk [Monad m] (L : MLList m α) (n : Nat) : MLList m (Array α) 
goal: MLList m (Array α)

full_name: MLList.chunk.go
code: /-- Group the elements of a lazy list into chunks of a given size.
If the lazy list is finite, the last chunk may be smaller (possibly even length 0). -/
partial def chunk [Monad m] (L : MLList m α) (n : Nat) : MLList m (Array α) 
goal: MLList m (Array α)

full_name: MLList.concat
code: /-- Add one element to the end of a monadic lazy list. -/
def concat [Monad m] (L : MLList m α) (a : α) : MLList m α 
goal: MLList m α

full_name: MLList.zip
code: /-- Take the product of two monadic lazy lists. -/
partial def zip [Monad m] (L : MLList m α) (M : MLList m β) : MLList.{u} m (α × β) 
goal: MLList m (α × β)

full_name: MLList.bind
code: /-- Apply a function returning a monadic lazy list to each element of a monadic lazy list,
joining the results. -/
partial def bind [Monad m] (xs : MLList m α) (f : α → MLList m β) : MLList m β 
goal: MLList m β

full_name: MLList.monadLift
code: /-- Convert any value in the monad to the singleton monadic lazy list. -/
def monadLift [Monad m] (x : m α) : MLList m α 
goal: MLList m α

full_name: MLList.liftM
code: /-- Lift the monad of a lazy list. -/
partial def liftM [Monad m] [Monad n] [MonadLiftT m n] (L : MLList m α) : MLList n α 
goal: MLList n α

full_name: MLList.runState
code: /-- Given a lazy list in a state monad, run it on some initial state, recording the states. -/
partial def runState [Monad m] (L : MLList (StateT.{u} σ m) α) (s : σ) : MLList m (α × σ) 
goal: MLList m (α × σ)

full_name: MLList.runState'
code: /-- Given a lazy list in a state monad, run it on some initial state. -/
def runState' [Monad m] (L : MLList (StateT.{u} σ m) α) (s : σ) : MLList m α 
goal: MLList m α

full_name: MLList.runReader
code: /-- Run a lazy list in a `ReaderT` monad on some fixed state. -/
partial def runReader [Monad m] (L : MLList (ReaderT.{u, u} ρ m) α) (r : ρ) :
    MLList m α 
goal: MLList m α

full_name: MLList.runStateRef
code: /-- Run a lazy list in a `StateRefT'` monad on some initial state. -/
partial def runStateRef [Monad m] [MonadLiftT (ST ω) m] (L : MLList (StateRefT' ω σ m) α) (s : σ) :
    MLList m α 
goal: MLList m α

full_name: MLList.head?
code: /-- Return the head of a monadic lazy list if it exists, as an `Option` in the monad. -/
def head? [Monad m] (L : MLList m α) : m (Option α) 
goal: m (Option α)

full_name: MLList.takeUpToFirstM
code: /-- Take the initial segment of the lazy list,
up to and including the first place where `f` gives `true`. -/
partial def takeUpToFirstM [Monad m] (L : MLList m α) (f : α → m (ULift Bool)) : MLList m α 
goal: MLList m α

full_name: MLList.takeUpToFirst
code: /-- Take the initial segment of the lazy list,
up to and including the first place where `f` gives `true`. -/
def takeUpToFirst [Monad m] (L : MLList m α) (f : α → Bool) : MLList m α 
goal: MLList m α

full_name: MLList.getLast?.aux
code: /-- Gets the last element of a monadic lazy list, as an option in the monad.
This will run forever if the list is infinite. -/
partial def getLast? [Monad m] (L : MLList m α) : m (Option α) 
goal: m (Option α)

full_name: MLList.getLast?
code: /-- Gets the last element of a monadic lazy list, as an option in the monad.
This will run forever if the list is infinite. -/
partial def getLast? [Monad m] (L : MLList m α) : m (Option α) 
goal: m (Option α)

full_name: MLList.getLast!
code: /-- Gets the last element of a monadic lazy list, or the default value if the list is empty.
This will run forever if the list is infinite. -/
partial def getLast! [Monad m] [Inhabited α] (L : MLList m α) : m α 
goal: m α

full_name: MLList.foldM
code: /-- Folds a binary function across a monadic lazy list, from an initial starting value.
This will run forever if the list is infinite. -/
partial def foldM [Monad m] (f : β → α → m β) (init : β) (L : MLList m α) : m β 
goal: m β

full_name: MLList.fold
code: /-- Folds a binary function across a monadic lazy list, from an initial starting value.
This will run forever if the list is infinite. -/
partial def fold [Monad m] (f : β → α → β) (init : β) (L : MLList m α) : m β 
goal: m β

full_name: MLList.head
code: /--
Return the head of a monadic lazy list, as a value in the monad.
Fails if the list is empty.
-/
def head [Monad m] [Alternative m] (L : MLList m α) : m α 
goal: m α

full_name: MLList.firstM
code: /--
Apply a function returning values inside the monad to a monadic lazy list,
returning only the first successful result.
-/
def firstM [Monad m] [Alternative m] (L : MLList m α) (f : α → m (Option β)) : m β 
goal: m β

full_name: MLList.first
code: /-- Return the first value on which a predicate returns true. -/
def first [Monad m] [Alternative m] (L : MLList m α) (p : α → Bool) : m α 
goal: m α

full_name: MLList.instMonad
code: instance [Monad m] : Monad (MLList m) 
goal: Monad (MLList m)

full_name: MLList.instAlternativeOfMonad
code: instance [Monad m] : Alternative (MLList m) 
goal: Alternative (MLList m)

full_name: MLList.instMonadLiftOfMonad
code: instance [Monad m] : MonadLift m (MLList m) 
goal: MonadLift m (MLList m)