hug
The license of that package is produced below:
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Functions
pub fn error(
in file_name: String,
containing source: String,
from start: #(Int, Int),
to end: #(Int, Int),
message msg: String,
hint hint: String,
) -> String
Returns a String
displaying the provided error and relevant code.
Example:
fn example() {
let source = "let five = 4 + 1.0"
source
|> hug.error(
in: "example.gleam",
from: #(1, 11),
to: #(1, 18),
message: "invalid type",
hint: "can not add an `Int` to a `Float`"
)
|> io.println()
}
pub fn info(
in file_name: String,
containing source: String,
from start: #(Int, Int),
to end: #(Int, Int),
message msg: String,
hint hint: String,
) -> String
Returns a String
displaying the provided info and relevant code.
Example:
fn example() {
let source = "try five = int.parse("4") |> result.then(fn(v) { v + 1})"
source
|> hug.info(
in: "example.gleam",
from: #(1, 1),
to: #(1, 4),
message: "use of deprecated code",
hint: "`try` is marked as deprecated, check out `use`!"
)
|> io.println()
}
pub fn warning(
in file_name: String,
containing source: String,
from start: #(Int, Int),
to end: #(Int, Int),
message msg: String,
hint hint: String,
) -> String
Returns a String
displaying the provided warning and relevant code.
Example:
fn example() {
let source = "let five = 4 + 1.0"
source
|> hug.warning(
in: "example.gleam",
from: #(1, 5),
to: #(1, 9),
message: "unused variable",
hint: "the variable `five` is declared but never used"
)
|> io.println()
}