This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import foreign data XImpl :: Type | |
type X = { a :: Number, b :: Number, impl :: XImpl } | |
foreign import foo :: forall eff. Eff eff X | |
--- | |
exports.foo = function() { | |
var x = doFoo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subscribeWithLast :: forall a b eff. | |
(b -> a -> Eff (frp :: FRP | eff) b) | |
-> b | |
-> Event a | |
-> Eff (frp :: FRP | eff) (Eff (frp :: FRP | eff) b) | |
subscribeWithLast f z evt = dropRefEff $ do | |
r <- newRef z | |
unsub <- | |
FRP.subscribe evt | |
(\e -> readRef r >>= \a -> addRefEff (f a e) >>= writeRef r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Jet a = { position :: a, velocity :: Change a } | |
destination :: forall a da. Patch a da => Jet a -> a | |
destination {position, velocity} = patch position (fromChange velocity) | |
newtype Incremental a b = Incremental (Jet a -> Jet b) | |
-- | Construct an incremental function from a function on Jets. The user must | |
-- | verify that these laws hold: | |
-- | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype Catch e r a = Catch forall x | |
. ( forall n e s | |
. IsSymbol n | |
=> Row.Cons n (FProxy (Except e)) r s | |
=> SProxy n | |
-> Run s a | |
-> (e -> Run r a) | |
-> x | |
) | |
-> x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Data.NaturalTransformation (type (~>)) | |
import Data.Symbol (class IsSymbol, SProxy) | |
import Prim.Row as Row | |
import Unsafe.Coerce (unsafeCoerce) | |
data VariantRF (s :: # Type) (r :: # Type) (a :: Type) | |
data RFProxy (f :: # Type -> Type -> Type) = RFProxy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Data.HList where | |
import Data.Semiring ((+)) | |
import Prim.RowList (Cons, Nil, kind RowList) | |
import Type.Data.RowList (RLProxy) | |
import Type.Equality (class TypeEquals) | |
newtype HList (xs :: RowList) = HList forall r | |
. (forall y ys. TypeEquals (RLProxy xs) (RLProxy (Cons "" y ys)) => y -> HList ys -> r) | |
-> (TypeEquals (RLProxy xs) (RLProxy Nil) => r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreign import kind Semilattice | |
foreign import data Meet ∷ Semilattice | |
foreign import data Join ∷ Semilattice | |
data SemilatticeProxy (s ∷ Semilattice) = SemilatticeProxy | |
class Semilattice (x ∷ Semilattice) a where | |
marry ∷ ∀ proxy. proxy x → a → a → a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class (LeftModule v a, RightModule v a) ⇐ Bimodule v a | |
newtype Pixels = Pixels (Additive Number) | |
derive newtype instance bimodulePixels ∷ Bimodule Pixels Number | |
--- | |
Cannot derive the type class instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (interrupt === null) { | |
switch (status) { | |
case SUSPEND: return util.stateSuspended; | |
case COMPLETED: return util.stateCompleted; | |
default: return util.stateRunning; | |
} | |
} | |
else { | |
switch (status) { | |
case COMPLETED: return util.stateKilled; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FRIST-SYNTAX | |
syntax Expr ::= Expr "+" Expr [left, strict] | |
| "(" Expr ")" [bracket] | |
| Ident | |
syntax Ident ::= "x" | "y" | "z" | |
endmodule |
OlderNewer