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

Commit ac29eaa

Browse files
authored
Merge pull request #69 from purescript-contrib/newtype-instances
Update some newtype instances
2 parents 46d07e9 + 3b123a1 commit ac29eaa

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/DOM/Event/Types.purs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import Prelude
3939
import Data.Either (Either(..))
4040
import Data.Foreign (F, Foreign, unsafeReadTagged)
4141
import Data.Foreign.Class (class IsForeign)
42+
import Data.Newtype (class Newtype)
4243
import Unsafe.Coerce as U
4344

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

50-
derive instance eqEventType :: Eq EventType
51-
derive instance ordEventType :: Ord EventType
51+
derive instance newtypeEventType :: Newtype EventType _
52+
derive newtype instance eqEventType :: Eq EventType
53+
derive newtype instance ordEventType :: Ord EventType
5254

5355
-- | A DOM item that can emit events.
5456
foreign import data EventTarget :: *

src/DOM/Node/Types.purs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
-- http://www.w3.org/TR/dom
22
module DOM.Node.Types where
33

4+
import Prelude
5+
import Data.Newtype (class Newtype)
46
import DOM.Event.Types (EventTarget)
57
import Unsafe.Coerce (unsafeCoerce)
68

@@ -32,6 +34,10 @@ foreign import data Element :: *
3234

3335
newtype ElementId = ElementId String
3436

37+
derive instance newtypeElementId :: Newtype ElementId _
38+
derive newtype instance eqElementId :: Eq ElementId
39+
derive newtype instance oOrdElementId :: Ord ElementId
40+
3541
elementToParentNode :: Element -> ParentNode
3642
elementToParentNode = unsafeCoerce
3743

0 commit comments

Comments
 (0)