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

Commit fec2d4b

Browse files
committed
Derive basic instances. Move History arg to last position.
1 parent f013751 commit fec2d4b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/DOM/HTML/History.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// module DOM.HTML.History
21
"use strict";
32

43
exports.back = function(history) {

src/DOM/HTML/History.purs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,26 @@ module DOM.HTML.History where
33
import Control.Monad.Eff (Eff)
44
import DOM.HTML.Types (HISTORY, History)
55
import Data.Foreign (Foreign)
6-
import Prelude (Unit)
6+
import Data.Newtype (class Newtype)
7+
import Prelude (class Eq, class Ord, Unit)
78

89
-- DocumentTitle will set value of `document.title`
910
newtype DocumentTitle = DocumentTitle String
11+
derive instance eqDocumentTitle :: Eq DocumentTitle
12+
derive instance ordDocumentTitle :: Ord DocumentTitle
13+
derive instance newtypeDocumentTitle :: Newtype DocumentTitle _
1014
newtype Delta = Delta Int
11-
newtype URL = URL String -- Unsure how to better type this.
15+
derive instance eqDelta :: Eq Delta
16+
derive instance ordDelta :: Ord Delta
17+
derive instance newtypeDelta :: Newtype Delta _
18+
newtype URL = URL String
19+
derive instance eqURL :: Eq URL
20+
derive instance ordURL :: Ord URL
21+
derive instance newtypeURL :: Newtype URL _
1222

1323
foreign import back :: forall e. History -> Eff (history :: HISTORY | e) Unit
1424
foreign import forward :: forall e. History -> Eff (history :: HISTORY | e) Unit
15-
foreign import go :: forall e. History -> Delta -> Eff (history :: HISTORY | e) Unit
16-
foreign import pushState :: forall e. History -> Foreign -> DocumentTitle -> URL -> Eff (history :: HISTORY | e) Unit
17-
foreign import replaceState :: forall e. History -> Foreign -> DocumentTitle -> URL -> Eff (history :: HISTORY | e) Unit
25+
foreign import go :: forall e. Delta -> History -> Eff (history :: HISTORY | e) Unit
26+
foreign import pushState :: forall e. Foreign -> DocumentTitle -> URL -> History -> Eff (history :: HISTORY | e) Unit
27+
foreign import replaceState :: forall e. Foreign -> DocumentTitle -> URL -> History -> Eff (history :: HISTORY | e) Unit
1828
foreign import state :: forall e. History -> Eff (history :: HISTORY | e) Foreign

0 commit comments

Comments
 (0)