grottohub / glyph

A purely Gleam Discord library built from the ground up with stratus.
24 stars 4 forks source link

Type errors on Gleam nightly #15

Open DJAruun opened 5 days ago

DJAruun commented 5 days ago

When I try to use this library on Gleam nightly (HEAD-3cc972c) I get this output and it doesn't start:

warning: Unused variable
   ┌─ /home/caarg/p/gleam/dean/build/packages/glyph/src/glyph/internal/cache.gleam:22:55
   │
22 │ fn get(cache: table.Set(String, String), key: String, default: String) -> String {
   │                                                       ^^^^^^^^^^^^^^^ This variable is never used

Hint: You can ignore it with an underscore: `_default`.

warning: Unused imported module
  ┌─ /home/caarg/p/gleam/dean/build/packages/glyph/src/glyph/internal/cache.gleam:7:1
  │
7 │ import gleam/pair
  │ ^^^^^^^^^^^^^^^^^ This imported module is never used

Hint: You can safely remove it.

warning: Unused imported module
  ┌─ /home/caarg/p/gleam/dean/build/packages/glyph/src/glyph/internal/cache.gleam:5:1
  │
5 │ import gleam/list
  │ ^^^^^^^^^^^^^^^^^ This imported module is never used

Hint: You can safely remove it.
error: Type mismatch
   ┌─ /home/caarg/p/gleam/dean/build/packages/glyph/src/glyph/internal/cache.gleam:12:3
   │  
12 │ ╭   table.build("glyph_session")
13 │ │   |> table.privacy(table.Public)
14 │ │   |> table.write_concurrency(table.AutoWriteConcurrency)
15 │ │   |> table.read_concurrency(False)
16 │ │   |> table.decentralized_counters(True)
17 │ │   |> table.compression(False)
18 │ │   |> table.set
   │ ╰──────────────^

The type of this returned value doesn't match the return type
annotation of this function.

Expected type:

    Set(String, String)

Found type:

    Result(Set(a, b), Nil)

error: Type mismatch
   ┌─ /home/caarg/p/gleam/dean/build/packages/glyph/src/glyph/internal/cache.gleam:24:6
   │
24 │   |> table.lookup(key)
   │      ^^^^^^^^^^^^^^^^^

Expected type:

    Option(a)

Found type:

    List(#(String, String))
okkdev commented 2 days ago

Carpenter introduced breaking changes in 0.3 I fixed that in my pull request (https://github.com/grottohub/glyph/pull/16), but I'm having different issues with it...