Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 811 Bytes

README.md

File metadata and controls

43 lines (31 loc) · 811 Bytes

Morsey

A package for encoding and decoding Morse code in Gleam.

Package Version Hex Docs

Usage

Encode

import gleam/io
import morsey

let text = "Hello world!"
case morsey.encode(text) {
  Ok(symbols) ->
    io.println("Morse code for " <> text <> " is " <> morsey.to_string(symbols))
  Error(morsey.InvalidCharacter(char)) ->
    io.println_error("Invalid character: " <> char)
}

Decode

import gleam/io
import morsey

".... . .-.. .-.. --- / .-- --- .-. .-.. -.. -.-.--"
|> morsey.from_string
|> morsey.decode
|> io.println

Development

gleam run   # Run the project
gleam test  # Run the tests