MD5 digests in Gren. import MD5 MD5.digest "hello" -- "5d41402abc4b2a76b9719d911017c592" MD5.digest "€ ♝ ♧ ☐" -- "2adb08ac813a93665950fe9203faca10" Mostly ported from elm-md5, with some help from elm-utf-tools and claude.| Gren Packages
Gren Effectful Test Runner Run Gren integration tests that depend on the actual results of tasks. See the full API on the package site. Quick Start Create a directory for your tests and initialize a gren program targeting node: mkdir tests cd tests gren init --platform=node Install the package: gren package install blaix/gren-effectful-tests Create a src/Main.gren with your tests. See the examples below, the working example in the repo, or the package docs for how to do that. Then compile and...| Gren Packages
gren-turso This package allows interfacing with both the Turso Platform API and the libSQL remote protocal, which allows executing SQL statements for databases on Turso over HTTP. Turso Platform API All modules related to the platform API are prefixed with Platform (i.e. Turso.Platform.Database), and deal with managing resources on Turso. For example, the Turso.Platform.Groups module allows adding, removing, or editing setting for groups within Turso. To send queries to Turso, a Turso.Platfor...| Gren Packages
SQLite for Gren Use sqlite entirely in Gren without ports via ws4sql. Note: this package expects the ws4sql fork of ws4sqlite. If you're using the npm package, you're all set. Otherwise, check the github releases of ws4sqlite for the latest ws4sql version (0.17.x). Usage Example Start a ws4sql database server: npx ws4sql --quick-db mydatabase.db This will create mydatabase.db if it doesn't exist and start a server available at http://localhost:12321/mydatabase. See docs for the npm package an...| Gren Packages
Base64 Encode strings and bytes as base64 strings. I may add decoding at some point but I currently don't need it. If you do and want to send a PR, that would be rad and cool. Usage Example import Bytes import Base64.Encode as Encode encodedString = "Hello" |> Encode.string |> Encode.encode -- returns: "SGVsbG8=" encodedBytes = "Hello" |> Bytes.fromString |> Encode.bytes |> Encode.encode -- returns: "SGVsbG8="| Gren Packages
Run Gren tests with effects on node| Gren Packages
Convert between ISO 8601 UTC timestamps and Time.Posix values| Gren Packages
Gren Browser Test Runner This package allows you to execute Gren tests and output the results in the browser. See gren-lang/test-runner-node if you want to run your tests on node. To define the actual tests, you'll need to use the gren-lang/test package. Quick start Initialize a gren program: mkdir tests cd tests gren init Install the necessary packages: gren package install gren-lang/test gren package install gren-lang/test-runner-browser Create a src/Main.gren with your tests: module Main e...| Gren Packages
Node specific functionality of the Gren compiler| Gren Packages
gren-json This package contains a JSON data type, a JSON parser, a function for pretty printing JSON documents. The parser is based on aramiscd/gren-parse. It is not very efficient but it strictly follows the grammar on json.org, so I'm pretty sure it can consume any valid JSON as long as it doesn't choke on the amount of data. Note that Gren's standard library is already equipped with modules for encoding and decoding JSON documents. This package is still useful if you want to explore a very...| Gren Packages
gren-parse A small library with all the basic building blocks to create combinatory parsers. It is much simpler than gren-lang/parser. Here is a parser for Booleans: import Parse parseBool = Parse.oneOf [ Parse.string "false" |> Parse.map ( \ _ -> [ False ] ) , Parse.string "true" |> Parse.map ( \ _ -> [ True ] ) ] > Parse.run parseBool "true" Just True : Maybe Bool > Parse.run parseBool "false" Just False : Maybe Bool > Parse.run parseBool "asdf" Nothing : Maybe Bool Package documentation: p...| Gren Packages
Gren TUI Build terminal user interfaces and games using The Elm Architecture (Model/View/Update) Track state in your model, listen for user input to update that state, and render your UI as a string representation of the current state. gren-tui will handle re-drawing only the lines you've output when your model changes. Uses the purely functional, very pleasant gren programming language. Example module Main exposing (main) import Init import Node import Task import Time import Tui main : Tui....| Gren Packages
Array 2D Gren package for working with 2-dimensional arrays (array of arrays). Useful in game dev and other architectures where you are often working with a 2-dimensional grid. myGrid = [ [ Grass, Grass, Grass ] , [ Water, Grass, Grass ] ] Array2d.get { x = 0, y = 1 } myGrid == Water Package docs| Gren Packages
test-runner-node This package allows you to execute tests and output the results to the terminal. To define the actual tests, you'll need to use the gren-lang/test package. Quick start A minimal test program will have the following in a Main.gren file: module Main exposing (main) import Test exposing (describe, test) import Test.Runner.Node exposing (Program, run) main : Program main = run <| describe "All tests" [ test "Failing test" <| \_ -> Expect.equal True False ]| Gren Packages
Gren's official test framework Write unit and fuzz tests for Gren code. This package allows you to define tests, but in order to run them you will need a test runner. This is a port of elm-explorations/test. Quick Start Here are three example tests: suite : Test suite = describe "The String module" [ describe "String.reverse" -- Nest as many descriptions as you like. [ test "has no effect on a palindrome" <| \_ -> let palindrome = "hannah" in Expect.equal palindrome (String.reverse palindrome...| Gren Packages
Gren ANSI ANSI escape sequences for grennode apps. import Ansi import Stream exposing (Stream) coolGreeting : Stream -> Cmd msg coolGreeting stdout = "Hello!" |> Ansi.wrapItalic |> Ansi.wrapColor Ansi.Green |> Stream.sendLine stdout See Ansi module docs for everything that's available. There are also functions for controlling the screen and cursor. See the gren-tui examples for usage in a full program, including interactivity!| Gren Packages
Shīkensu シーケンス Sequence Run a sequence of functions on in-memory representations of files. Build static websites with ease, without conforming to a specific structure. Markdown example import Bytes exposing ( Bytes ) import Shikensu import Shikensu.Contrib as Shikensu import Shikensu.Definition as Shikensu import Shikensu.Focus as Shikensu exposing ( Focus(..) ) import Shikensu.Path as Path import Task main : Shikensu.Program main = -- 🚀 Shikensu.program sequence CurrentDirector...| Gren Packages
A commonmark markdown package for Gren. ⚠️ This mostly works, but the test suite is incomplete and a few features are still missing. Commonmark This package implements pretty much the entire Commonmark spec, but there are a few small differences: It doesn't parse open HTML tags that are not closed. To do [ ] Allow for custom inline & block parsers to be passed in Parser implementations [x] Blockquotes [x] Code blocks (fenced & indented) [x] Headers [x] Lists (ordered & unordered) [x] Them...| Gren Packages
A SVG package for Gren, uses the HTML package as the foundation. import Transmutable.Html import Transmutable.Html.VirtualDom import Transmutable.Svg exposing (Svg, svg) import Transmutable.Svg.Attributes as A someSvg : Svg msg -- Just an alias for `Transmutable.Html.Html msg` someSvg = svg [ A.fill "none" , A.viewBox "0 0 201 233" ] [] string = Transmutable.Html.toString someSvg virtualDom = Transmutable.Html.VirtualDom.toVirtualDom someSvg You can convert this SVG/HTML to VirtualDom using t...| Gren Packages
VirtualDom transmutationist for the Gren icidasset/html-gren package. import Browser import Transmutable.Html exposing (div) import Transmutable.Html.VirtualDom exposing (toVirtualDom) someHtml = div [] [] main = Browser.sandbox { init = {} , view = view , update = \_ _ -> {} } view model = toVirtualDom someHtml| Gren Packages
A HTML package for Gren. import Transmutable.Html exposing (Html, html, head, title, body, main_, h1, text) import Transmutable.Html.Attributes as A (Attribute) someHtml = html [ A.lang "en" ] [ head [] [ title [ text "HTML document" ] ] , body [] [ main_ [] [ h1 [] [ text "👋" ] ] ] ] string = Html.toString someHtml You can also convert this HTML to VirtualDom using this package. Parsing import Transmutable.Html as Html Html.fromString "<html><body><!-- Contents --></body></html>" Parsers ...| Gren Packages
Gren Playground Create pictures, animations, and games with Gren! This is a port of elm-playground. Start by putting shapes on screen and work up to making games. I hope this package will be fun for a broad range of ages and backgrounds! Pictures A picture is a list of shapes. For example, this picture combines a brown rectangle and a green circle to make a tree: import Playground exposing (..) main = picture [ rectangle brown 40 200 , circle green 100 |> moveUp 100 ] Play around to get famil...| Gren Packages
Pretty Nice Framework A purely functional, fully type-safe, full-stack web framework for Gren. Your code runs on the server, but your responses can include fully-interactive, client-side components that run in the browser. Initialize those components with data server-side and you don't have to deal with loading states or data fetching errors. Follow @blaix@hachyderm.io or check the gren zulip for updates. Table of Contents <!-- vim-markdown-toc GFM --> Installation Basic Example Server-side H...| Gren Packages
gren-static-serve Serve static files from a directory using the HttpServer module of the gren-node package. For more information on how to use this package, check out the docs for the Server.Static module. This package doesn't have any automated testsing written for it and may have some undiscovered bugs or odd behavior. If you discover anything not working or not working as documented, please file a bug on Github!| Gren Packages
gren-args A package for parsing arguments passed from the gren/node package. Getting started To get started with this package, it's assumed you've already setup your program with the gren/node package. Once you have your program running, you can get its arguments from the configuration object passed from the Node.initalize function. You can then parse those arguments using the Args.parse function in this package. Here's a code example: Node.Program.await Node.initialize (\configuration -> let...| Gren Packages