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 #51 from spicydonuts/master
Browse files Browse the repository at this point in the history
Updates for psc 0.9.1
  • Loading branch information
garyb authored Jun 10, 2016
2 parents 6077455 + 5d2929d commit 3b66568
Show file tree
Hide file tree
Showing 150 changed files with 600 additions and 770 deletions.
20 changes: 13 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@
"package.json"
],
"dependencies": {
"purescript-unsafe-coerce": "^0.1.0",
"purescript-enums": "^0.7.0",
"purescript-foreign": "^0.7.0",
"purescript-exceptions": "~0.3.0",
"purescript-nullable": "~0.2.1",
"purescript-datetime": "~0.9.1",
"purescript-media-types": "~0.1.1"
"purescript-unsafe-coerce": "^1.0.0",
"purescript-enums": "^1.0.0",
"purescript-foreign": "^1.0.0",
"purescript-exceptions": "~1.0.0",
"purescript-nullable": "^1.0.0",
"purescript-datetime": "~1.0.0",
"purescript-media-types": "~1.0.0",
"purescript-prelude": "^1.0.0",
"purescript-foldable-traversable": "^1.0.0",
"purescript-js-date": "^1.0.0"
},
"devDependencies": {
"purescript-psci-support": "^1.0.0"
}
}
2 changes: 0 additions & 2 deletions src/DOM/Event/DragEvent/DataTransfer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";

// module DOM.Event.DragEvent.DataTransfer

exports.files = function (dataTransfer) {
return dataTransfer.files;
};
2 changes: 1 addition & 1 deletion src/DOM/Event/DragEvent/DataTransfer.purs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module DOM.Event.DragEvent.DataTransfer where

import DOM.File.Types (FileList())
import DOM.File.Types (FileList)

foreign import data DataTransfer :: *

Expand Down
2 changes: 0 additions & 2 deletions src/DOM/Event/Event.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";

// module DOM.Event.Event

exports.bubbles = function (e) {
return e.bubbles;
};
Expand Down
19 changes: 8 additions & 11 deletions src/DOM/Event/Event.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ module DOM.Event.Event
) where

import Prelude

import Control.Monad.Eff (Eff())

import Control.Monad.Eff (Eff)
import Data.Enum (toEnum)
import qualified Data.Maybe.Unsafe as U

import DOM
import DOM.Event.EventPhase
import DOM.Event.Types
import DOM.Node.Types
import Data.Maybe (fromJust)
import DOM (DOM)
import DOM.Event.EventPhase (EventPhase)
import DOM.Event.Types (Event, EventType)
import DOM.Node.Types (Node)

-- | The event type.
foreign import type_ :: Event -> EventType
Expand All @@ -36,8 +33,8 @@ foreign import currentTarget :: Event -> Node

-- | Indicates which phase of the event flow that is currently being processed
-- | for the event.
eventPhase :: Event -> EventPhase
eventPhase = U.fromJust <<< toEnum <<< eventPhaseIndex
eventPhase :: Partial => Event -> EventPhase
eventPhase = fromJust <<< toEnum <<< eventPhaseIndex

-- | The integer value for the current event phase.
foreign import eventPhaseIndex :: Event -> Int
Expand Down
16 changes: 5 additions & 11 deletions src/DOM/Event/EventPhase.purs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module DOM.Event.EventPhase (EventPhase(..)) where

import Prelude

import Data.Enum (Enum, Cardinality(..), defaultSucc, defaultPred)
import Data.Enum (class Enum, class BoundedEnum, Cardinality(..), defaultSucc, defaultPred)
import Data.Maybe (Maybe(..))

data EventPhase
Expand All @@ -11,12 +10,7 @@ data EventPhase
| AtTarget
| Bubbling

instance eqEventPhase :: Eq EventPhase where
eq None None = true
eq Capturing Capturing = true
eq AtTarget AtTarget = true
eq Bubbling Bubbling = true
eq _ _ = false
derive instance eqEventPhase :: Eq EventPhase

instance ordEventPhase :: Ord EventPhase where
compare x y = compare (fromEnumEventPhase x) (fromEnumEventPhase y)
Expand All @@ -25,12 +19,12 @@ instance boundedEventPhase :: Bounded EventPhase where
bottom = None
top = Bubbling

instance boundedOrdEventPhase :: BoundedOrd EventPhase

instance enumEventPhase :: Enum EventPhase where
cardinality = Cardinality 4
succ = defaultSucc toEnumEventPhase fromEnumEventPhase
pred = defaultPred toEnumEventPhase fromEnumEventPhase

instance boundedEnumEventPhase :: BoundedEnum EventPhase where
cardinality = Cardinality 4
toEnum = toEnumEventPhase
fromEnum = fromEnumEventPhase

Expand Down
2 changes: 0 additions & 2 deletions src/DOM/Event/EventTarget.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";

// module DOM.Event.EventTarget

exports.eventListener = function (fn) {
return function (event) {
return fn(event)();
Expand Down
10 changes: 4 additions & 6 deletions src/DOM/Event/EventTarget.purs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
module DOM.Event.EventTarget where

import Prelude

import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Exception (EXCEPTION())

import DOM
import DOM.Event.Types
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Exception (EXCEPTION)
import DOM (DOM)
import DOM.Event.Types (EventTarget, Event, EventType)

-- | A boxed function that can be used as an event listener. This is necessary
-- | due to the underling implementation of Eff functions.
Expand Down
6 changes: 3 additions & 3 deletions src/DOM/Event/Types.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* global EventTarget */
"use strict";

// module DOM.Event.Types

exports._readEventTarget = function (left) {
return function (right) {
return function (foreign) {
return foreign instanceof EventTarget ? left("Value is not an EventTarget") : right(foreign);
return foreign instanceof EventTarget
? left("Value is not an EventTarget")
: right(foreign);
};
};
};
Loading

0 comments on commit 3b66568

Please sign in to comment.