user27126509
user27126509

Reputation:

How do I import a whole library in gleam

I was trying to import all functions from a library in gleam and using them without having to do string.<some_method> (just <some_method>), but I keep getting the following error:

error: Syntax error
  ┌─ src/bob.gleam:2:22
  │
2 │ import gleam/string.{*}
  │                      ^ I was not expecting this
Found `*`, expected one of: 
- `}`

I tried with a simple import gleam/string.{*} but it's not working :(

I also looked in the official guide, but I didn't seem to find anything helpful.

Upvotes: 0

Views: 195

Answers (1)

aldisti
aldisti

Reputation: 57

At the moment there's no way to achieve that. But you could specify the methods names in the curly brackets, even though after 2 or 3 of them it becomes unreadable.

Something like this:

import gleam/string.{is_empty, uppercase, lowercase}

Upvotes: 1

Related Questions