ghc-9.12: The GHC API
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 HaskellNone
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 Special Source # 
Instance details

Defined in GHC.StgToJS.Regs

ToJExpr StgReg Source # 
Instance details

Defined in GHC.StgToJS.Regs

ToJExpr StgRet Source # 
Instance details

Defined in GHC.StgToJS.Regs

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 (Solo a) Source # 
Instance details

Defined in GHC.JS.Make

Methods

argList :: Solo a -> [Ident] Source #

args :: JSM (Solo 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 FastString 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 application expression, 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 #

Constructors

MkSolo a 

Bundled Patterns

pattern Solo :: a -> Solo a 

Instances

Instances details
Foldable1 Solo Source #

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

fold1 :: Semigroup m => Solo m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Solo a -> m Source #

foldMap1' :: Semigroup m => (a -> m) -> Solo a -> m Source #

toNonEmpty :: Solo a -> NonEmpty a Source #

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

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

head :: Solo a -> a Source #

last :: Solo a -> a Source #

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

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Solo a -> b Source #

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

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Solo a -> b Source #

Eq1 Solo Source #

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

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

Ord1 Solo Source #

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

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

Read1 Solo Source #

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

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

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

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

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

Show1 Solo Source #

Since: base-4.15

Instance details

Defined in Data.Functor.Classes

Methods

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

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

NFData1 Solo Source #

Since: deepseq-1.4.6.0

Instance details

Defined in Control.DeepSeq

Methods

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

Applicative Solo # 
Instance details

Defined in GHC.Internal.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 # 
Instance details

Defined in GHC.Internal.Base

Methods

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

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

Monad Solo # 
Instance details

Defined in GHC.Internal.Base

Methods

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

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

return :: a -> Solo a #

MonadFix Solo # 
Instance details

Defined in GHC.Internal.Control.Monad.Fix

Methods

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

Foldable Solo # 
Instance details

Defined in GHC.Internal.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 #

Traversable Solo # 
Instance details

Defined in GHC.Internal.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) #

Generic1 Solo # 
Instance details

Defined in GHC.Internal.Generics

Associated Types

type Rep1 Solo 
Instance details

Defined in GHC.Internal.Generics

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

Methods

from1 :: Solo a -> Rep1 Solo a #

to1 :: Rep1 Solo a -> Solo a #

NFData a => NFData (Solo a) Source #

Since: deepseq-1.4.6.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Solo a -> () Source #

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

Defined in GHC.JS.Make

Methods

argList :: Solo a -> [Ident] Source #

args :: JSM (Solo a) Source #

Monoid a => Monoid (Solo a) # 
Instance details

Defined in GHC.Internal.Base

Methods

mempty :: Solo a #

mappend :: Solo a -> Solo a -> Solo a #

mconcat :: [Solo a] -> Solo a #

Semigroup a => Semigroup (Solo a) # 
Instance details

Defined in GHC.Internal.Base

Methods

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

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

stimes :: Integral b => b -> Solo a -> Solo a #

Data a => Data (Solo a) # 
Instance details

Defined in GHC.Internal.Data.Data

Methods

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

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

toConstr :: Solo a -> Constr #

dataTypeOf :: Solo a -> DataType #

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

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

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

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

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

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

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

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

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

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

Bounded a => Bounded (Solo a) # 
Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: Solo a #

maxBound :: Solo a #

Enum a => Enum (Solo a) # 
Instance details

Defined in GHC.Internal.Enum

Methods

succ :: Solo a -> Solo a #

pred :: Solo a -> Solo a #

toEnum :: Int -> Solo a #

fromEnum :: Solo a -> Int #

enumFrom :: Solo a -> [Solo a] #

enumFromThen :: Solo a -> Solo a -> [Solo a] #

enumFromTo :: Solo a -> Solo a -> [Solo a] #

enumFromThenTo :: Solo a -> Solo a -> Solo a -> [Solo a] #

Generic (Solo a) # 
Instance details

Defined in GHC.Internal.Generics

Associated Types

type Rep (Solo a) 
Instance details

Defined in GHC.Internal.Generics

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

Methods

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

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

Ix a => Ix (Solo a) # 
Instance details

Defined in GHC.Internal.Ix

Methods

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

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

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

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

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

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

Read a => Read (Solo a) # 
Instance details

Defined in GHC.Internal.Read

Show a => Show (Solo a) # 
Instance details

Defined in GHC.Internal.Show

Methods

showsPrec :: Int -> Solo a -> ShowS #

show :: Solo a -> String #

showList :: [Solo a] -> ShowS #

Eq a => Eq (Solo a) # 
Instance details

Defined in GHC.Classes

Methods

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

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

Ord a => Ord (Solo a) # 
Instance details

Defined in GHC.Classes

Methods

compare :: Solo a -> Solo a -> Ordering #

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

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

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

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

max :: Solo a -> Solo a -> Solo a #

min :: Solo a -> Solo a -> Solo a #

type Rep1 Solo # 
Instance details

Defined in GHC.Internal.Generics

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

Defined in GHC.Internal.Generics

type Rep (Solo a) = D1 ('MetaData "Solo" "GHC.Tuple" "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