I’m going to treat this page as a sort of wiki for PureScript tips and reference.
Searching for Special Character Operators
You can search Pursuit for special character operators by wrapping them in parenthesis, e.g you can search for (<$) if you don’t know that
<$ is the same as
voidRight, or you can search for (<|>) if you don’t know that
<|> is the same as
Package Sets Organized By Project Type
The idea of this section is to determine which packages should be the starting point for a particular project type, and of those packages, which functions should be compiled into a more easily usable Prelude.
- Front End Single Page App
- Any Project
- Eff, log, logShow, CONSOLE, Maybe, Either, Tuple
You can derive a Generic instance for simple types by doing
derive instance someName :: Generic SomeType
Deriving Newtypes without Type Parameters
Sometimes Newtypes for Records don’t have a type parameter, in which case you will need to derive the instance using a typed hole, e.g.
derive instance newtypeMyNewType :: Newtype MyNewType _
Data Constructors of Abstract Data Types (ADT) are imported using
import Module (Type(..)), e.g. if you want to import the Constructors of this ADT…
module Routes where data Location = Home | Login
import Routes (Location(..)). Note that this is different than saying
import Routes(Location). The first import says to import the constructors of the Location type. The second is saying to import the Location type itself.