diff --git a/Stdlib/Data/List.juvix b/Stdlib/Data/List.juvix index f62aa06d..0091378d 100644 --- a/Stdlib/Data/List.juvix +++ b/Stdlib/Data/List.juvix @@ -16,11 +16,6 @@ import Stdlib.Trait.Foldable open using { fromPolymorphicFoldable; }; ---- 𝒪(1). Partial function that returns the first element of a ;List;. -phead {A} {{Partial}} : List A -> A - | (x :: _) := x - | nil := fail "head: empty list"; - instance eqListI {A} {{Eq A}} : Eq (List A) := let diff --git a/Stdlib/Data/List/Base.juvix b/Stdlib/Data/List/Base.juvix index bc8d0900..425a850b 100644 --- a/Stdlib/Data/List/Base.juvix +++ b/Stdlib/Data/List/Base.juvix @@ -7,6 +7,7 @@ import Stdlib.Function open; import Stdlib.Data.Nat.Base open; import Stdlib.Data.Maybe.Base open; import Stdlib.Trait.Ord open; +import Stdlib.Trait.Partial open; import Stdlib.Data.Pair.Base open; --- 𝒪(𝓃). Returns ;true; if the given object elem is in the ;List;. @@ -165,6 +166,11 @@ head {A} (defaultValue : A) (list : List A) : A := | x :: _ := x | nil := defaultValue; +--- 𝒪(1). Partial function that returns the first element of a ;List;. +phead {A} {{Partial}} : List A -> A + | (x :: _) := x + | nil := fail "head: empty list"; + syntax iterator any {init := 0; range := 1}; --- 𝒪(𝓃). Returns ;true; if at least one element of the ;List; satisfies the predicate. diff --git a/Stdlib/Debug/Fail.juvix b/Stdlib/Debug/Fail.juvix index 45a106e6..bfc03523 100644 --- a/Stdlib/Debug/Fail.juvix +++ b/Stdlib/Debug/Fail.juvix @@ -1,6 +1,6 @@ module Stdlib.Debug.Fail; -import Stdlib.Data.String.Base open; +import Juvix.Builtin.V1.String open; --- Exit the program with an error message. builtin fail diff --git a/Stdlib/Trait/Partial.juvix b/Stdlib/Trait/Partial.juvix index 1670c417..9b2e3449 100644 --- a/Stdlib/Trait/Partial.juvix +++ b/Stdlib/Trait/Partial.juvix @@ -1,6 +1,6 @@ module Stdlib.Trait.Partial; -import Stdlib.Data.String.Base open; +import Juvix.Builtin.V1.String open; import Stdlib.Debug.Fail as Debug; trait