We're sure you have your reasons.
What if we could do FFI without writing javascript much, if it all?
This library sits at the unsafeCoerce end of the safety scale - it
is expected that your usage of these functions will provide the
necessary safety while we provide the primitives with low overhead and
little imposition upon how you structure your code.
import FFI.Simple
import Data.Array as A
foreign import data React :: Type
foreign import data Element :: Type
react :: React
react = require 'react'
createElement :: forall r. String -> Record r -> Array Element -> Element
createElement c p cs = applyTo react (args3 c p cs)Send it a message -- Joe Armstrong (1950-2019)
F.S.Functions:delayno longer selects for effect with a closed typeclass
- Upgraded build to purescript 0.3.5
F.S.Functions:delaynow uses a closed typeclass to select for Effect
- Brought all the deps used for build and test up to date
- Fixed warnings
F.S.Objects:keysremoveProperty((!-), infix 9, probably wrong, please suggest a better value)- Made
(.=)infix 9. This is probably still wrong, please suggest a better value. - Made
(!=)infix 9. This is probably still wrong, please suggest a better value.
Improvements:
F.S.Globals:- Made
globalcheck not justwindow, but alsoglobalThis,global, so supporting any environment. But nodejs is shit, so it's basically useless in that environment.
- Made
F.S.Objects:downcast
- Improved tests for existing functionality
New:
F.S.Functions:new
F.S.Objects:- Property checks:
hasOwnProperty- non-inherited propsisIn- possibly inherited props
- Safer Property access:
(.?)maybeGetPropertymaybeGetProperty'
- Property checks:
F.S.Undef:maybeUndef- theMaybeanalogue ofnullUndef
Improvements:
F.S.Globals:- Warns on module load if
windowis not defined - If
windowis not defined:globalwill always returnNothingunsafeGlobalwill always quietly returnundef
- Warns on module load if
Breakages:
F.S.Undef:Undefined->Undefundefined->undef
New:
F.S.Globals:unsafeGlobal- Assume a global will be present, quietly returnundefif it is not. (Bring your own safety!)
Breakages:
F.S.Functions:bind'->bindToapply->applyTodelaynow takes a value to provide
F.S.Objects:typeof->typeOf
New:
F.S.Globals(new module):global- look up a global by name
F.S.Objects:instanceOf- wrapper for jsinstanceof(.=)/setProperty'to set a property(!=)/defineProperty'to define a readonly property
- Remove
F.S.Requireas i can't figure out how to make a build work with it. - Remove
call,callMethodandcallMethod'fromF.S.Functions - Add
F.S.Functions.delay - Made dotty operators infixl
- Depend on effect and refs
- Add
F.S.PseudoArray.unshift
Copyright (c) 2019 James Laver
This software is free and open source software licensed under the terms of the Mozilla Public License (MPL) 2.0