Skip to content

error when pattern matching on props #104

Closed
@coot

Description

@coot

Consider a react class:

data Message
  = Hello
  | Bye

instance showMessage :: Show Message where
  show Hello = "Hello :)"
  show Bye = "Bye!"

cls :: ReactClass Message
cls = createClass (spec unit renderFn)
  where
    renderFn this = do
      msg <- getProps this
      pure $ div' [ text (show msg) ]

When rendering it PureScript will fail to pattern match on Hello and Bye and will error.

index.js:34228 Uncaught Error: Failed pattern match at Main line 24, column 1 - line 24, column 37: Object

screenshot from 2017-07-14 19-14-32

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions