Skip to content

Commit

Permalink
Format standard library with all the changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed Sep 18, 2023
1 parent 493b94f commit 56185e5
Show file tree
Hide file tree
Showing 55 changed files with 573 additions and 573 deletions.
22 changes: 11 additions & 11 deletions core/source/Array.mint
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module Array {
*/
fun any (array : Array(item), function : Function(item, Bool)) : Bool {
case Array.find(array, function) {
Maybe::Nothing => false
Maybe::Just => true
Maybe.Nothing => false
Maybe.Just => true
}
}

Expand Down Expand Up @@ -45,8 +45,8 @@ module Array {
[],
(memo : Array(item), item : Maybe(item)) : Array(item) {
case item {
Maybe::Just(value) => Array.push(memo, value)
Maybe::Nothing => memo
Maybe.Just(value) => Array.push(memo, value)
Maybe.Nothing => memo
}
})
}
Expand Down Expand Up @@ -406,9 +406,9 @@ module Array {
*/
fun max (array : Array(Number)) : Maybe(Number) {
if Array.size(array) > 0 {
Maybe::Just(`Math.max(...#{array})`)
Maybe.Just(`Math.max(...#{array})`)
} else {
Maybe::Nothing
Maybe.Nothing
}
}
Expand All @@ -421,9 +421,9 @@ module Array {
*/
fun min (array : Array(Number)) : Maybe(Number) {
if Array.size(array) > 0 {
Maybe::Just(`Math.min(...#{array})`)
Maybe.Just(`Math.min(...#{array})`)
} else {
Maybe::Nothing
Maybe.Nothing
}
}
Expand Down Expand Up @@ -748,7 +748,7 @@ module Array {
for item, index of array {
item
} when {
indexOf(array, item) == Maybe::Just(index)
indexOf(array, item) == Maybe.Just(index)
}
}

Expand Down Expand Up @@ -782,8 +782,8 @@ module Array {
method : Function(item, item)
) : Array(item) {
case array[index] {
Maybe::Just(item) => setAt(array, index, method(item))
Maybe::Nothing => array
Maybe.Just(item) => setAt(array, index, method(item))
Maybe.Nothing => array
}
}
}
22 changes: 11 additions & 11 deletions core/source/Console.mint
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Console {
fun assert (assertion : Bool, value : a, values : Array(b) = []) : Tuple(Bool, a, Array(b)) {
`console.assert(#{assertion}, #{value}, ...#{values})`

{assertion, value, values}
#(assertion, value, values)
}

/*
Expand All @@ -53,7 +53,7 @@ module Console {
`console.count(#{label})`
Console.Counter.increment(label)

{label, Console.Counter.get(label)}
#(label, Console.Counter.get(label))
}

/*
Expand All @@ -66,7 +66,7 @@ module Console {
`console.countReset(#{label})`
Console.Counter.clear(label)

{label, Console.Counter.get(label)}
#(label, Console.Counter.get(label))
}

/*
Expand All @@ -79,7 +79,7 @@ module Console {
fun debug (value : a, values : Array(b) = []) : Tuple(a, Array(b)) {
`console.debug(#{value}, ...#{values})`

{value, values}
#(value, values)
}

/*
Expand Down Expand Up @@ -113,7 +113,7 @@ module Console {
fun error (value : a, values : Array(b) = []) : Tuple(a, Array(b)) {
`console.error(#{value}, ...#{values})`

{value, values}
#(value, values)
}

/*
Expand Down Expand Up @@ -157,7 +157,7 @@ module Console {
fun info (value : a, values : Array(b) = []) : Tuple(a, Array(b)) {
`console.info(#{value}, ...#{values})`

{value, values}
#(value, values)
}

/*
Expand All @@ -170,7 +170,7 @@ module Console {
fun log (value : a, values : Array(b) = []) : Tuple(a, Array(b)) {
`console.log(#{value}, ...#{values})`

{value, values}
#(value, values)
}

/*
Expand Down Expand Up @@ -219,7 +219,7 @@ module Console {
`console.table(#{data})`
}

{data, columns}
#(data, columns)
}

/*
Expand Down Expand Up @@ -252,7 +252,7 @@ module Console {
fun timeLog (label : String = "Default", values : Array(a) = []) : Tuple(String, Array(a)) {
`console.timeLog(#{label}, ...#{values})`

{label, values}
#(label, values)
}

/*
Expand Down Expand Up @@ -280,7 +280,7 @@ module Console {
fun trace (value : a, values : Array(b)) : Tuple(a, Array(b)) {
`console.trace(#{value}, ...#{values})`

{value, values}
#(value, values)
}

/*
Expand All @@ -291,6 +291,6 @@ module Console {
fun warn (value : a, values : Array(b) = []) : Tuple(a, Array(b)) {
`console.warn(#{value}, ...#{values})`

{value, values}
#(value, values)
}
}
6 changes: 3 additions & 3 deletions core/source/Dom.mint
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ module Dom {
*/
fun focus (maybeElement : Maybe(Dom.Element)) : Promise(Void) {
case maybeElement {
Maybe::Just(element) =>
Maybe.Just(element) =>
{
focusWhenVisible(element)
Promise.resolve(void)
}

Maybe::Nothing => Promise.resolve(void)
Maybe.Nothing => Promise.resolve(void)
}
}

Expand Down Expand Up @@ -388,7 +388,7 @@ module Dom {
let hash =
String.parameterize(text)

{tag, text, hash}
#(tag, text, hash)
})
}

Expand Down
2 changes: 1 addition & 1 deletion core/source/Dom/Dimensions.mint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Record for the dimensions of an element on the screen. */
record Dom.Dimensions {
type Dom.Dimensions {
height : Number,
bottom : Number,
width : Number,
Expand Down
2 changes: 1 addition & 1 deletion core/source/Html.Event.mint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Represents an HTML event. */
record Html.Event {
type Html.Event {
bubbles : Bool,
cancelable : Bool,
currentTarget : Dom.Element,
Expand Down
12 changes: 6 additions & 6 deletions core/source/Http.mint
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Represents a HTTP header */
record Http.Header {
type Http.Header {
value : String,
key : String
}

/* Represents an HTTP request. */
record Http.Request {
type Http.Request {
headers : Array(Http.Header),
withCredentials : Bool,
body : Http.Body,
Expand All @@ -14,15 +14,15 @@ record Http.Request {
}

/* Represents an HTTP response. */
record Http.Response {
type Http.Response {
headers : Map(String, String),
body : Http.ResponseBody,
bodyString : String,
status : Number
}

/* Represents the body of a HTTP response. */
enum Http.ResponseBody {
type Http.ResponseBody {
JSON(Object)
HTML(Object)
Text(String)
Expand All @@ -31,15 +31,15 @@ enum Http.ResponseBody {
}

/* Represents an HTTP request which failed to load. */
record Http.ErrorResponse {
type Http.ErrorResponse {
headers : Map(String, String),
type : Http.Error,
status : Number,
url : String
}

/* Represents the possible failures of an HTTP request. */
enum Http.Error {
type Http.Error {
/* The request cannot be loaded because of a network failure */
NetworkError

Expand Down
6 changes: 3 additions & 3 deletions core/source/Map.mint
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Map {
fun delete (map : Map(key, value), keyToDelete : key) : Map(key, value) {
Map.fromArray(
for key, value of map {
{key, value}
#(key, value)
} when {
key != keyToDelete
})
Expand All @@ -32,7 +32,7 @@ module Map {
fun deleteValues (map : Map(key, value), valueToDelete : value) : Map(key, value) {
Map.fromArray(
for key, value of map {
{key, value}
#(key, value)
} when {
value != valueToDelete
})
Expand Down Expand Up @@ -178,7 +178,7 @@ module Map {
) : Map(key, result) {
Map.fromArray(
for key, value of map {
({key, function(key, value)})
(#(key, function(key, value)))
})
}

Expand Down
30 changes: 15 additions & 15 deletions core/source/Maybe.mint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* The data structure for Maybe. */
enum Maybe(value) {
type Maybe(value) {
Just(value)
Nothing
}
Expand All @@ -22,8 +22,8 @@ module Maybe {
transform : Function(value, Maybe(result))
) : Maybe(result) {
case maybe {
Maybe::Just(value) => transform(value)
Maybe::Nothing => Maybe::Nothing
Maybe.Just(value) => transform(value)
Maybe.Nothing => Maybe.Nothing
}
}

Expand All @@ -36,8 +36,8 @@ module Maybe {
*/
fun flatten (maybe : Maybe(Maybe(value))) : Maybe(value) {
case maybe {
Maybe::Nothing => Maybe::Nothing
Maybe::Just(value) => value
Maybe.Nothing => Maybe.Nothing
Maybe.Just(value) => value
}
}

Expand All @@ -48,7 +48,7 @@ module Maybe {
Maybe.isJust(Maybe.nothing()) == false
*/
fun isJust (maybe : Maybe(value)) : Bool {
maybe != Maybe::Nothing
maybe != Maybe.Nothing
}

/*
Expand All @@ -58,12 +58,12 @@ module Maybe {
Maybe.isNothing(Maybe.nothing("A")) == false
*/
fun isNothing (maybe : Maybe(value)) : Bool {
maybe == Maybe::Nothing
maybe == Maybe.Nothing
}

/* Returns a maybe containing just the given value. */
fun just (value : value) : Maybe(value) {
Maybe::Just(value)
Maybe.Just(value)
}

/*
Expand All @@ -74,14 +74,14 @@ module Maybe {
*/
fun map (maybe : Maybe(value), func : Function(value, result)) : Maybe(result) {
case maybe {
Maybe::Just(value) => Maybe::Just(func(value))
Maybe::Nothing => Maybe::Nothing
Maybe.Just(value) => Maybe.Just(func(value))
Maybe.Nothing => Maybe.Nothing
}
}

/* Returns nothing. */
fun nothing : Maybe(value) {
Maybe::Nothing
Maybe.Nothing
}

/*
Expand All @@ -103,8 +103,8 @@ module Maybe {
*/
fun toResult (maybe : Maybe(value), error : error) : Result(error, value) {
case maybe {
Maybe::Just(value) => Result::Ok(value)
Maybe::Nothing => Result::Err(error)
Maybe.Just(value) => Result.Ok(value)
Maybe.Nothing => Result.Err(error)
}
}

Expand All @@ -126,8 +126,8 @@ module Maybe {
*/
fun withLazyDefault (maybe : Maybe(value), func : Function(value)) : value {
case maybe {
Maybe::Nothing => func()
Maybe::Just(value) => value
Maybe.Nothing => func()
Maybe.Just(value) => value
}
}
}
2 changes: 1 addition & 1 deletion core/source/MutationObserver.mint
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
record MutationObserver.Entry {
type MutationObserver.Entry {
target : Dom.Element,
type : String
}
Expand Down
2 changes: 1 addition & 1 deletion core/source/Provider/AnimationFrame.mint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Represents a subscription for `Provider.AnimationFrame` */
record Provider.AnimationFrame.Subscription {
type Provider.AnimationFrame.Subscription {
frames : Function(Number, Promise(Void))
}

Expand Down
Loading

0 comments on commit 56185e5

Please sign in to comment.