ghc-lib-parser-9.10.1.20240511: The GHC API, decoupled from GHC versions
Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file LICENSE)
MaintainerJeffrey Young <jeffrey.young@iohk.io> Luite Stegeman <luite.stegeman@iohk.io> Sylvain Henry <sylvain.henry@iohk.io> Josh Meredith <josh.meredith@iohk.io>
Stabilityexperimental
Safe HaskellIgnore
LanguageGHC2021

GHC.JS.Make

Description

  • Domain and Purpose

    GHC.JS.Make defines helper functions to ease the creation of JavaScript ASTs as defined in Syntax. Its purpose is twofold: make the EDSL more ergonomic to program in, and make errors in the EDSL look obvious because the EDSL is untyped. It is primarily concerned with injecting terms into the domain of the EDSL to construct JS programs in Haskell.

  • Strategy

    The strategy for this module comes straight from gentzen; where we have two types of helper functions. Functions which inject terms into the EDSL, and combinator functions which operate on terms in the EDSL to construct new terms in the EDSL. Crucially, missing from this module are corresponding elimination or destructing functions which would project information from the EDSL back to Haskell. See Utils for such functions.

    • Introduction functions

      We define various primitive helpers which introduce terms in the EDSL, for example jVar, jLam, and var and jString. Similarly this module exports four typeclasses ToExpr, ToStat, JVarMagic, JSArgument. ToExpr injects values as a JS expression into the EDSL. ToStat injects values as JS statements into the EDSL. JVarMagic provides a polymorphic way to introduce a new name into the EDSL and JSArgument provides a polymorphic way to bind variable names for use in JS functions with different arities.

    • Combinator functions

      The rest of the module defines combinators which create terms in the EDSL from terms in the EDSL. Notable examples are |= and ||=, |= is sugar for AssignStat, it is a binding form that declares foo = bar assuming foo has been already declared. ||= is more sugar on top of |=, it is also a binding form that declares the LHS of |= before calling |= to bind a value, bar, to a variable foo. Other common examples are the if_ and math_ helpers such as math_cos.

  • Consumers

    The entire JS backend consumes this module, e.g., the modules in GHC.StgToJS.*.

  • Notation

    In this module we use ==> in docstrings to show the translation from the JS EDSL domain to JS code. For example, foo ||= bar ==> var foo; foo = bar; should be read as foo ||= bar is in the EDSL domain and results in the JS code var foo; foo = bar; when compiled.

    In most cases functions prefixed with a j are monadic because the observably allocate. Notable exceptions are jwhenS, jString and the helpers for HashMaps.

Synopsis

Injection Type classes

The ToJExpr class handles injection of of things into the EDSL as a JS expression

class ToJExpr a where Source #

Things that can be marshalled into javascript values. Instantiate for any necessary data structures.

Minimal complete definition

toJExpr

Instances

Instances details
ToJExpr FastString Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr Ident Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr JStgExpr Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr JVal Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr CIStatic Source #

static refs: array = references, null = nothing to report note: only works after all top-level objects have been created

Instance details

Defined in GHC.StgToJS.Types

ToJExpr ClosureType Source # 
Instance details

Defined in GHC.StgToJS.Types

ToJExpr JSRep Source # 
Instance details

Defined in GHC.StgToJS.Types

ToJExpr StaticLit Source # 
Instance details

Defined in GHC.StgToJS.Types

ToJExpr Integer Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr () Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr Bool Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr Char Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr Double Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr Int Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr a => ToJExpr [a] Source # 
Instance details

Defined in GHC.JS.Make

Methods

toJExpr :: [a] -> JStgExpr Source #

toJExprFromList :: [[a]] -> JStgExpr Source #

ToJExpr a => ToJExpr (Map String a) Source # 
Instance details

Defined in GHC.JS.Make

ToJExpr a => ToJExpr (UniqMap FastString a) Source # 
Instance details

Defined in GHC.JS.Make

(ToJExpr a, ToJExpr b) => ToJExpr (a, b) Source # 
Instance details

Defined in GHC.JS.Make

Methods

toJExpr :: (a, b) -> JStgExpr Source #

toJExprFromList :: [(a, b)] -> JStgExpr Source #

(ToJExpr a, ToJExpr b, ToJExpr c) => ToJExpr (a, b, c) Source # 
Instance details

Defined in GHC.JS.Make

Methods

toJExpr :: (a, b, c) -> JStgExpr Source #

toJExprFromList :: [(a, b, c)] -> JStgExpr Source #

(ToJExpr a, ToJExpr b, ToJExpr c, ToJExpr d) => ToJExpr (a, b, c, d) Source # 
Instance details

Defined in GHC.JS.Make

Methods

toJExpr :: (a, b, c, d) -> JStgExpr Source #

toJExprFromList :: [(a, b, c, d)] -> JStgExpr Source #

(ToJExpr a, ToJExpr b, ToJExpr c, ToJExpr d, ToJExpr e) => ToJExpr (a, b, c, d, e) Source # 
Instance details

Defined in GHC.JS.Make

Methods

toJExpr :: (a, b, c, d, e) -> JStgExpr Source #

toJExprFromList :: [(a, b, c, d, e)] -> JStgExpr Source #

(ToJExpr a, ToJExpr b, ToJExpr c, ToJExpr d, ToJExpr e, ToJExpr f) => ToJExpr (a, b, c, d, e, f) Source # 
Instance details

Defined in GHC.JS.Make

Methods

toJExpr :: (a, b, c, d, e, f) -> JStgExpr Source #

toJExprFromList :: [(a, b, c, d, e, f)] -> JStgExpr Source #

class ToStat a where Source #

The ToStat class handles injection of of things into the EDSL as a JS statement. This ends up being polymorphic sugar for JS blocks, see helper function expr2stat. Instantiate for any necessary data structures.

Methods

toStat :: a -> JStgStat Source #

Instances

Instances details
ToStat JStgExpr Source # 
Instance details

Defined in GHC.JS.Make

ToStat JStgStat Source # 
Instance details

Defined in GHC.JS.Make

ToStat [JStgExpr] Source # 
Instance details

Defined in GHC.JS.Make

ToStat [JStgStat] Source # 
Instance details

Defined in GHC.JS.Make

class JVarMagic a where Source #

Type class that generates fresh a's for the JS backend. You should almost never need to use this directly. Instead use JSArgument, for examples of how to employ these classes please see jVar, jFunction and call sites in the Rts.

Methods

fresh :: JSM a Source #

Instances

Instances details
JVarMagic Ident Source # 
Instance details

Defined in GHC.JS.Make

Methods

fresh :: JSM Ident Source #

JVarMagic JStgExpr Source # 
Instance details

Defined in GHC.JS.Make

JVarMagic JVal Source # 
Instance details

Defined in GHC.JS.Make

Methods

fresh :: JSM JVal Source #

class JSArgument args where Source #

Type class that finds the form of arguments required for a JS syntax object. This class gives us a single interface to generate variables for functions that have different arities. Thus with it, we can have only one jFunction which is polymorphic over its arity, instead of jFunction2, jFunction3 and so on.

Methods

argList :: args -> [Ident] Source #

args :: JSM args Source #

Instances

Instances details
(JVarMagic a, ToJExpr a) => JSArgument (a) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a) -> [Ident] Source #

args :: JSM (a) Source #

(JVarMagic a, JVarMagic b, ToJExpr a, ToJExpr b) => JSArgument (a, b) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b) -> [Ident] Source #

args :: JSM (a, b) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c) => JSArgument (a, b, c) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c) -> [Ident] Source #

args :: JSM (a, b, c) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c, JVarMagic d, ToJExpr d) => JSArgument (a, b, c, d) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c, d) -> [Ident] Source #

args :: JSM (a, b, c, d) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c, JVarMagic d, ToJExpr d, JVarMagic e, ToJExpr e) => JSArgument (a, b, c, d, e) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c, d, e) -> [Ident] Source #

args :: JSM (a, b, c, d, e) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c, JVarMagic d, ToJExpr d, JVarMagic e, ToJExpr e, JVarMagic f, ToJExpr f) => JSArgument (a, b, c, d, e, f) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c, d, e, f) -> [Ident] Source #

args :: JSM (a, b, c, d, e, f) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c, JVarMagic d, ToJExpr d, JVarMagic e, ToJExpr e, JVarMagic f, ToJExpr f, JVarMagic g, ToJExpr g) => JSArgument (a, b, c, d, e, f, g) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c, d, e, f, g) -> [Ident] Source #

args :: JSM (a, b, c, d, e, f, g) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c, JVarMagic d, ToJExpr d, JVarMagic e, ToJExpr e, JVarMagic f, ToJExpr f, JVarMagic g, ToJExpr g, JVarMagic h, ToJExpr h) => JSArgument (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c, d, e, f, g, h) -> [Ident] Source #

args :: JSM (a, b, c, d, e, f, g, h) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c, JVarMagic d, ToJExpr d, JVarMagic e, ToJExpr e, JVarMagic f, ToJExpr f, JVarMagic g, ToJExpr g, JVarMagic h, ToJExpr h, JVarMagic i, ToJExpr i) => JSArgument (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c, d, e, f, g, h, i) -> [Ident] Source #

args :: JSM (a, b, c, d, e, f, g, h, i) Source #

(JVarMagic a, ToJExpr a, JVarMagic b, ToJExpr b, JVarMagic c, ToJExpr c, JVarMagic d, ToJExpr d, JVarMagic e, ToJExpr e, JVarMagic f, ToJExpr f, JVarMagic g, ToJExpr g, JVarMagic h, ToJExpr h, JVarMagic i, ToJExpr i, JVarMagic j, ToJExpr j) => JSArgument (a, b, c, d, e, f, g, h, i, j) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a, b, c, d, e, f, g, h, i, j) -> [Ident] Source #

args :: JSM (a, b, c, d, e, f, g, h, i, j) Source #

Introduction functions

jString :: FastString -> JStgExpr Source #

Convert a ShortText to a Javascript String

jLam :: JSArgument args => (args -> JSM JStgStat) -> JSM JStgExpr Source #

Create a new anonymous function. The result is a JExpr expression. Usage:

jLam $ \x -> jVar x + one_
jLam $ \f -> (jLam $ \x -> (f `app` (x `app` x))) `app` (jLam $ \x -> (f `app` (x `app` x)))

jLam' :: JStgStat -> JStgExpr Source #

Special case of jLam where the anonymous function requires no fresh arguments.

jFunction Source #

Arguments

:: JSArgument args 
=> Ident

global name

-> (args -> JSM JStgStat)

function body, input is locally unique generated variables

-> JSM JStgStat 

Construct a top-level function subject to JS hoisting. This combinator is polymorphic over function arity so you can you use to define a JS syntax object in Haskell, which is a function in JS that takes 2 or 4 or whatever arguments. For a singleton function use the Solo constructor MkSolo. Usage:

an example from the Rts that defines a 1-arity JS function > jFunction (global "h$getReg") ((MkSolo n) -> return $ SwitchStat n getRegCases mempty)

an example of a two argument function from the Rts > jFunction (global "h$bh_lne") ((x, frameSize) -> bhLneStats s x frameSize)

jFunctionSized Source #

Arguments

:: Ident

global name

-> Int

Arity

-> ([JStgExpr] -> JSM JStgStat)

function body, input is locally unique generated variables

-> JSM JStgStat 

Construct a top-level function subject to JS hoisting. Special case where the arity cannot be deduced from the args parameter (atleast not without dependent types).

jFunction' Source #

Arguments

:: Ident

global name

-> JSM JStgStat

function body, input is locally unique generated variables

-> JSM JStgStat 

Construct a top-level function subject to JS hoisting. Special case where the function binds no parameters

jVar :: (JVarMagic t, ToJExpr t) => (t -> JSM JStgStat) -> JSM JStgStat Source #

Introduce only one new variable into scope for the duration of the enclosed expression. The result is a block statement. Usage:

'jVar $ x -> mconcat [jVar x ||= one_, ...'

jVars :: JSArgument args => (args -> JSM JStgStat) -> JSM JStgStat Source #

Introduce one or many new variables into scope for the duration of the enclosed expression. This function reifies the number of arguments based on the container of the input function. We intentionally avoid lists and instead opt for tuples because lists are not sized in general. The result is a block statement. Usage:

jVars $ (x,y) -> mconcat [ x |= one_,  y |= two_,  x + y]

jFor Source #

Arguments

:: (JStgExpr -> JStgStat)

initialization function

-> (JStgExpr -> JStgExpr)

predicate

-> (JStgExpr -> JStgStat)

step function

-> (JStgExpr -> JStgStat)

body

-> JSM JStgStat 

Create a for statement given a function for initialization, a predicate to step to, a step and a body Usage:

 jFor (|= zero_) (.<. Int 65536) preIncrS
        (j -> ...something with the counter j...)

jForIn :: JStgExpr -> (JStgExpr -> JStgStat) -> JSM JStgStat Source #

Create a 'for in' statement. Usage:

jForIn {expression} $ x -> {block involving x}

jForEachIn :: JStgExpr -> (JStgExpr -> JStgStat) -> JSM JStgStat Source #

As with "jForIn" but creating a "for each in" statement.

jTryCatchFinally :: (Ident -> JStgStat) -> (Ident -> JStgStat) -> (Ident -> JStgStat) -> JSM JStgStat Source #

As with "jForIn" but creating a "for each in" statement.

Combinators

Combinators operate on terms in the JS EDSL domain to create new terms in the EDSL domain.

(||=) :: Ident -> JStgExpr -> JStgStat infixl 2 Source #

Declare a variable and then Assign the variable to an expression

foo |= expr ==> var foo; foo = expr;

(|=) :: JStgExpr -> JStgExpr -> JStgStat infixl 2 Source #

Assign a variable to an expression

foo |= expr ==> var foo = expr;

(.==.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 6 Source #

JS infix Equality operators

(.===.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 6 Source #

JS infix Equality operators

(.!=.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 6 Source #

JS infix Equality operators

(.!==.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 6 Source #

JS infix Equality operators

(.!) :: JStgExpr -> JStgExpr -> JStgExpr infixl 8 Source #

return the expression at idx of obj

obj .! idx ==> obj[idx]

(.>.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 7 Source #

JS infix Ord operators

(.>=.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 7 Source #

JS infix Ord operators

(.<.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 7 Source #

JS infix Ord operators

(.<=.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 7 Source #

JS infix Ord operators

(.<<.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 9 Source #

JS infix bit shift operators

(.>>.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 9 Source #

JS infix bit shift operators

(.>>>.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 9 Source #

JS infix bit shift operators

(.|.) :: JStgExpr -> JStgExpr -> JStgExpr Source #

JS infix bit operators

(.||.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 8 Source #

JS infix bit operators

(.&&.) :: JStgExpr -> JStgExpr -> JStgExpr infixl 8 Source #

JS infix bit operators

if_ :: JStgExpr -> JStgExpr -> JStgExpr -> JStgExpr Source #

JS if-expression

if_ e1 e2 e3 ==> e1 ? e2 : e3

if10 :: JStgExpr -> JStgExpr Source #

if-expression that returns 1 if condition = true, 0 otherwise

if10 e ==> e ? 1 : 0

if01 :: JStgExpr -> JStgExpr Source #

if-expression that returns 0 if condition = true, 1 otherwise

if01 e ==> e ? 0 : 1

ifS :: JStgExpr -> JStgStat -> JStgStat -> JStgStat Source #

If-expression which returns statements, see related ifBlockS

if e s1 s2 ==> if(e) { s1 } else { s2 }

ifBlockS :: JStgExpr -> [JStgStat] -> [JStgStat] -> JStgStat Source #

If-expression which returns blocks

ifBlockS e s1 s2 ==> if(e) { s1 } else { s2 }

jBlock :: Monoid a => [JSM a] -> JSM a Source #

jIf :: JStgExpr -> JSM JStgStat -> JSM JStgStat -> JSM JStgStat Source #

Version of a JS if-expression which admits monadic actions in its branches

jwhenS :: JStgExpr -> JStgStat -> JStgStat Source #

A when-statement as syntactic sugar via ifS

jwhenS cond block ==> if(cond) { block } else {  }

app :: FastString -> [JStgExpr] -> JStgExpr Source #

an expression application, see related appS

app f xs ==> f(xs)

appS :: FastString -> [JStgExpr] -> JStgStat Source #

A statement application, see the expression form app

loop :: JStgExpr -> (JStgExpr -> JStgExpr) -> (JStgExpr -> JSM JStgStat) -> JSM JStgStat Source #

"for" loop with increment at end of body

loopBlockS :: JStgExpr -> (JStgExpr -> JStgExpr) -> (JStgExpr -> [JStgStat]) -> JSM JStgStat Source #

"for" loop with increment at end of body

preIncrS :: JStgExpr -> JStgStat Source #

Prefix-increment a JStgExpr

postIncrS :: JStgExpr -> JStgStat Source #

Postfix-increment a JStgExpr

preDecrS :: JStgExpr -> JStgStat Source #

Prefix-decrement a JStgExpr

postDecrS :: JStgExpr -> JStgStat Source #

Postfix-decrement a JStgExpr

off8 :: JStgExpr -> JStgExpr -> JStgExpr Source #

Byte indexing of o with a 8-bit offset

off16 :: JStgExpr -> JStgExpr -> JStgExpr Source #

Byte indexing of o with a 16-bit offset

off32 :: JStgExpr -> JStgExpr -> JStgExpr Source #

Byte indexing of o with a 32-bit offset

off64 :: JStgExpr -> JStgExpr -> JStgExpr Source #

Byte indexing of o with a 64-bit offset

mask8 :: JStgExpr -> JStgExpr Source #

a bit mask to retrieve the lower 8-bits

mask16 :: JStgExpr -> JStgExpr Source #

a bit mask to retrieve the lower 16-bits

signExtend8 :: JStgExpr -> JStgExpr Source #

Sign-extend/narrow a 8-bit value

signExtend16 :: JStgExpr -> JStgExpr Source #

Sign-extend/narrow a 16-bit value

typeof :: JStgExpr -> JStgExpr Source #

Given a JStgExpr, return the its type.

nullStat :: JStgStat Source #

The empty JS statement

(.^) :: JStgExpr -> FastString -> JStgExpr infixl 8 Source #

Select a property prop, from and object obj

obj .^ prop ==> obj.prop

Hash combinators

jhEmpty :: Map k JStgExpr Source #

The empty JS HashMap

jhSingle :: (Ord k, ToJExpr a) => k -> a -> Map k JStgExpr Source #

A singleton JS HashMap

jhAdd :: (Ord k, ToJExpr a) => k -> a -> Map k JStgExpr -> Map k JStgExpr Source #

insert a key-value pair into a JS HashMap

jhFromList :: [(FastString, JStgExpr)] -> JVal Source #

Construct a JS HashMap from a list of key-value pairs

Literals

Literals in the JS EDSL are constants in the Haskell domain. These are useful helper values and never change

null_ :: JStgExpr Source #

The JS literal null

false_ :: JStgExpr Source #

The JS literal false

true_ :: JStgExpr Source #

The JS literal true

zero_ :: JStgExpr Source #

The JS literal 0

one_ :: JStgExpr Source #

The JS literal 1

two_ :: JStgExpr Source #

The JS literal 2

three_ :: JStgExpr Source #

The JS literal 3

Math functions

Math functions in the EDSL are literals, with the exception of math_ which is the sole math introduction function.

Statement helpers

data Solo a #

Solo is the canonical lifted 1-tuple, just like (,) is the canonical lifted 2-tuple (pair) and (,,) is the canonical lifted 3-tuple (triple).

The most important feature of Solo is that it is possible to force its "outside" (usually by pattern matching) without forcing its "inside", because it is defined as a datatype rather than a newtype. One situation where this can be useful is when writing a function to extract a value from a data structure. Suppose you write an implementation of arrays and offer only this function to index into them:

index :: Array a -> Int -> a

Now imagine that someone wants to extract a value from an array and store it in a lazy-valued finite map/dictionary:

insert "hello" (arr index 12) m

This can actually lead to a space leak. The value is not actually extracted from the array until that value (now buried in a map) is forced. That means the entire array may be kept live by just that value! Often, the solution is to use a strict map, or to force the value before storing it, but for some purposes that's undesirable.

One common solution is to include an indexing function that can produce its result in an arbitrary Applicative context:

indexA :: Applicative f => Array a -> Int -> f a

When using indexA in a pure context, Solo serves as a handy Applicative functor to hold the result. You could write a non-leaky version of the above example thus:

case arr indexA 12 of
  Solo a -> insert "hello" a m

While such simple extraction functions are the most common uses for unary tuples, they can also be useful for fine-grained control of strict-spined data structure traversals, and for unifying the implementations of lazy and strict mapping functions.

Constructors

MkSolo a 

Bundled Patterns

pattern Solo :: a -> (a) 

Instances

Instances details
MonadFix Solo

Since: base-4.15

Instance details

Defined in Control.Monad.Fix

Methods

mfix :: (a -> Solo a) -> Solo a #

Foldable Solo

Since: base-4.15

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => Solo m -> m #

foldMap :: Monoid m => (a -> m) -> Solo a -> m #

foldMap' :: Monoid m => (a -> m) -> Solo a -> m #

foldr :: (a -> b -> b) -> b -> Solo a -> b #

foldr' :: (a -> b -> b) -> b -> Solo a -> b #

foldl :: (b -> a -> b) -> b -> Solo a -> b #

foldl' :: (b -> a -> b) -> b -> Solo a -> b #

foldr1 :: (a -> a -> a) -> Solo a -> a #

foldl1 :: (a -> a -> a) -> Solo a -> a #

toList :: Solo a -> [a] #

null :: Solo a -> Bool #

length :: Solo a -> Int #

elem :: Eq a => a -> Solo a -> Bool #

maximum :: Ord a => Solo a -> a #

minimum :: Ord a => Solo a -> a #

sum :: Num a => Solo a -> a #

product :: Num a => Solo a -> a #

Eq1 Solo

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Solo a -> Solo b -> Bool #

Ord1 Solo

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Solo a -> Solo b -> Ordering #

Read1 Solo

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Solo a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Solo a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Solo a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Solo a] #

Show1 Solo

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Solo a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Solo a] -> ShowS #

Traversable Solo

Since: base-4.15

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Solo a -> f (Solo b) #

sequenceA :: Applicative f => Solo (f a) -> f (Solo a) #

mapM :: Monad m => (a -> m b) -> Solo a -> m (Solo b) #

sequence :: Monad m => Solo (m a) -> m (Solo a) #

Applicative Solo

Since: base-4.15

Instance details

Defined in GHC.Base

Methods

pure :: a -> Solo a #

(<*>) :: Solo (a -> b) -> Solo a -> Solo b #

liftA2 :: (a -> b -> c) -> Solo a -> Solo b -> Solo c #

(*>) :: Solo a -> Solo b -> Solo b #

(<*) :: Solo a -> Solo b -> Solo a #

Functor Solo

Since: base-4.15

Instance details

Defined in GHC.Base

Methods

fmap :: (a -> b) -> Solo a -> Solo b #

(<$) :: a -> Solo b -> Solo a #

Monad Solo

Since: base-4.15

Instance details

Defined in GHC.Base

Methods

(>>=) :: Solo a -> (a -> Solo b) -> Solo b #

(>>) :: Solo a -> Solo b -> Solo b #

return :: a -> Solo a #

NFData1 Solo

Since: deepseq-1.4.6.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> Solo a -> () #

Generic1 Solo 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 Solo :: k -> Type #

Methods

from1 :: forall (a :: k). Solo a -> Rep1 Solo a #

to1 :: forall (a :: k). Rep1 Solo a -> Solo a #

Data a => Data (a)

Since: base-4.15

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> (a) -> c (a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (a) #

toConstr :: (a) -> Constr #

dataTypeOf :: (a) -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (a)) #

gmapT :: (forall b. Data b => b -> b) -> (a) -> (a) #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> (a) -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> (a) -> r #

gmapQ :: (forall d. Data d => d -> u) -> (a) -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> (a) -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> (a) -> m (a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> (a) -> m (a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> (a) -> m (a) #

Monoid a => Monoid (a)

Since: base-4.15

Instance details

Defined in GHC.Base

Methods

mempty :: (a) #

mappend :: (a) -> (a) -> (a) #

mconcat :: [(a)] -> (a) #

Semigroup a => Semigroup (a)

Since: base-4.15

Instance details

Defined in GHC.Base

Methods

(<>) :: (a) -> (a) -> (a) #

sconcat :: NonEmpty (a) -> (a) #

stimes :: Integral b => b -> (a) -> (a) #

Bounded a => Bounded (a) 
Instance details

Defined in GHC.Enum

Methods

minBound :: (a) #

maxBound :: (a) #

Enum a => Enum (a) 
Instance details

Defined in GHC.Enum

Methods

succ :: (a) -> (a) #

pred :: (a) -> (a) #

toEnum :: Int -> (a) #

fromEnum :: (a) -> Int #

enumFrom :: (a) -> [(a)] #

enumFromThen :: (a) -> (a) -> [(a)] #

enumFromTo :: (a) -> (a) -> [(a)] #

enumFromThenTo :: (a) -> (a) -> (a) -> [(a)] #

Generic (a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a) :: Type -> Type #

Methods

from :: (a) -> Rep (a) x #

to :: Rep (a) x -> (a) #

Ix a => Ix (a) 
Instance details

Defined in GHC.Ix

Methods

range :: ((a), (a)) -> [(a)] #

index :: ((a), (a)) -> (a) -> Int #

unsafeIndex :: ((a), (a)) -> (a) -> Int #

inRange :: ((a), (a)) -> (a) -> Bool #

rangeSize :: ((a), (a)) -> Int #

unsafeRangeSize :: ((a), (a)) -> Int #

Read a => Read (a)

Since: base-4.15

Instance details

Defined in GHC.Read

Methods

readsPrec :: Int -> ReadS (a) #

readList :: ReadS [(a)] #

readPrec :: ReadPrec (a) #

readListPrec :: ReadPrec [(a)] #

Show a => Show (a)

Since: base-4.15

Instance details

Defined in GHC.Show

Methods

showsPrec :: Int -> (a) -> ShowS #

show :: (a) -> String #

showList :: [(a)] -> ShowS #

NFData a => NFData (a)

Since: deepseq-1.4.6.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a) -> () #

(JVarMagic a, ToJExpr a) => JSArgument (a) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: (a) -> [Ident] Source #

args :: JSM (a) Source #

Eq a => Eq (a) 
Instance details

Defined in GHC.Classes

Methods

(==) :: (a) -> (a) -> Bool #

(/=) :: (a) -> (a) -> Bool #

Ord a => Ord (a) 
Instance details

Defined in GHC.Classes

Methods

compare :: (a) -> (a) -> Ordering #

(<) :: (a) -> (a) -> Bool #

(<=) :: (a) -> (a) -> Bool #

(>) :: (a) -> (a) -> Bool #

(>=) :: (a) -> (a) -> Bool #

max :: (a) -> (a) -> (a) #

min :: (a) -> (a) -> (a) #

type Rep1 Solo

Since: base-4.15

Instance details

Defined in GHC.Generics

type Rep1 Solo = D1 ('MetaData "Solo" "GHC.Tuple.Prim" "ghc-prim" 'False) (C1 ('MetaCons "MkSolo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep (a)

Since: base-4.15

Instance details

Defined in GHC.Generics

type Rep (a) = D1 ('MetaData "Solo" "GHC.Tuple.Prim" "ghc-prim" 'False) (C1 ('MetaCons "MkSolo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

decl :: Ident -> JStgStat Source #

construct a js declaration with the given identifier

Orphan instances