Package

purescript-data-default

Repository
thought2/purescript-data-default
License
Apache-2.0
Uploaded by
thought2
Published on
2019-09-05T17:16:12Z

Latest release

Default values for purescript types. Inspired by Haskell's data-default package

Installation

bower install purescript-data-default

Documentation

Module documentation is published on Pursuit.

Example


import Data.Default
import Data.Maybe (Maybe)

-- Has value 1
x :: Int
x = def

-- Has value Nothing
y :: Maybe String
y = def

data User
  = User String Int

instance defaultUser :: Default User where
  def = User "Max" 99

-- Has value `User "Max" 99`
user :: User
user = def

-- Has value `{name : "", user : User "Max" 99 }`
record :: { name :: String, user :: User }
record = def
Modules
Data.Default
Dependencies