purescript-elm-basics

Purescript port of Elm core library's Basics


License
Unlicense
Install
bower install purescript-elm-basics

Documentation

purescript-elm-basics

This is a Purescript port of the Basics module from Elm's core library. This library only defines a few values, the rest are available from Purescript libraries or the Prelude.

This library is intended to help port Elm libraries and programs to Purescript.

Installation and Usage

bower install purescript-elm-basics

import Elm.Basics

Elm.Basics Module Contents

Please also see the detailed Module Documentation.

  • The built-in type Number is used instead of Float

  • degrees, radians, turns are functions with type Number -> Number

  • clamp :: Number -> Number -> Number -> Number

  • <| and |> are provided and synonymous with $ and #

Not Included

The other types and values from Elm's Basics all have Purescript analogues and can be imported from their respective modules, so they were not included. Here's a short migration guide:

Prelude

  • ==, /=, <, >, <=, >=, +, -, *, /, negate, not, &&, ||, ++, otherwise, flip can be imported from Purescript's Prelude

  • << and >> become <<< and >>> from Prelude

  • toString is superseded by the show method of the Show typeclass from Prelude

  • identity becomes id, and always becomes const, from Prelude

  • Order becomes Ordering and is used with the compare method of the Ord typeclass from Prelude

  • xor becomes .^. from the Bits type class, of which there is an instance for Num

Math

  • max, min, round, floor, abs, sqrt, e, pi, cos, sin, tan, acos, asin, atan, atan2 are in module Math from purescript-math

  • ceiling becomes ceil, and ^ becomes pow in Math

Data.Tuple

Data.Int

  • toNumber (to be used instead of toFloat), as well as floor, ceil, round and others are in Data.Int from purescript-integers

Global

TODO

  • //, rem, %, logBase, truncate

  • toPolar, fromPolar