Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #69 from purescript-contrib/newtype-instances
Browse files Browse the repository at this point in the history
Update some newtype instances
  • Loading branch information
garyb authored Nov 16, 2016
2 parents 46d07e9 + 3b123a1 commit ac29eaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/DOM/Event/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Prelude
import Data.Either (Either(..))
import Data.Foreign (F, Foreign, unsafeReadTagged)
import Data.Foreign.Class (class IsForeign)
import Data.Newtype (class Newtype)
import Unsafe.Coerce as U

-- | Basic type for all DOM events.
Expand All @@ -47,8 +48,9 @@ foreign import data Event :: *
-- | The type of strings used for event types.
newtype EventType = EventType String

derive instance eqEventType :: Eq EventType
derive instance ordEventType :: Ord EventType
derive instance newtypeEventType :: Newtype EventType _
derive newtype instance eqEventType :: Eq EventType
derive newtype instance ordEventType :: Ord EventType

-- | A DOM item that can emit events.
foreign import data EventTarget :: *
Expand Down
6 changes: 6 additions & 0 deletions src/DOM/Node/Types.purs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- http://www.w3.org/TR/dom
module DOM.Node.Types where

import Prelude
import Data.Newtype (class Newtype)
import DOM.Event.Types (EventTarget)
import Unsafe.Coerce (unsafeCoerce)

Expand Down Expand Up @@ -32,6 +34,10 @@ foreign import data Element :: *

newtype ElementId = ElementId String

derive instance newtypeElementId :: Newtype ElementId _
derive newtype instance eqElementId :: Eq ElementId
derive newtype instance oOrdElementId :: Ord ElementId

elementToParentNode :: Element -> ParentNode
elementToParentNode = unsafeCoerce

Expand Down

0 comments on commit ac29eaa

Please sign in to comment.