Skip to content

Commit

Permalink
Add Monoid instance for JSX (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
spicydonuts authored May 25, 2018
1 parent 705e7d4 commit 5e38d1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions generated-docs/React/Basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ data JSX :: Type

A virtual DOM element.

##### Instances
``` purescript
Semigroup JSX
Monoid JSX
```

#### `ReactComponent`

``` purescript
Expand Down
7 changes: 7 additions & 0 deletions src/React/Basic.purs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ import Prelude
import Control.Monad.Eff (Eff, kind Effect)
import Control.Monad.Eff.Uncurried (EffFn3, mkEffFn3)
import Data.Function.Uncurried (Fn2, Fn3, mkFn3, runFn2)
import Data.Monoid (class Monoid)
import Unsafe.Coerce (unsafeCoerce)

-- | A virtual DOM element.
foreign import data JSX :: Type

instance semigroupJSX :: Semigroup JSX where
append a b = fragment [ a, b ]

instance monoidJSX :: Monoid JSX where
mempty = empty

-- | A React component which can be used from JavaScript.
foreign import data ReactComponent :: Type -> Type

Expand Down

0 comments on commit 5e38d1d

Please sign in to comment.