From 3120691a539a6fffd220a693c813ada816198e2d Mon Sep 17 00:00:00 2001 From: justinwoo Date: Sat, 12 May 2018 21:41:09 +0300 Subject: [PATCH 1/2] changes for 0.12 --- .travis.yml | 10 ++++++++-- bower.json | 18 +++++++++--------- package.json | 7 +++---- src/CSS/Animation.purs | 10 +++++----- src/CSS/Background.purs | 22 +++++++++++----------- src/CSS/Border.purs | 4 ++-- src/CSS/Box.purs | 4 ++-- src/CSS/Common.purs | 4 +--- src/CSS/Display.purs | 16 +++++++++------- src/CSS/Flexbox.purs | 14 +++++++------- src/CSS/Font.purs | 8 ++++---- src/CSS/FontFace.purs | 6 +++--- src/CSS/Gradient.purs | 6 +++--- src/CSS/ListStyle/Image.purs | 7 ++++--- src/CSS/ListStyle/Position.purs | 7 ++++--- src/CSS/ListStyle/Type.purs | 7 ++++--- src/CSS/Overflow.purs | 4 ++-- src/CSS/Property.purs | 14 +++++++------- src/CSS/Render.purs | 25 +++++++++++-------------- src/CSS/Selector.purs | 10 +++++----- src/CSS/Size.purs | 6 +++--- src/CSS/String.purs | 2 +- src/CSS/Stylesheet.purs | 16 ++++++++-------- src/CSS/Text.purs | 4 ++-- src/CSS/Text/Transform.purs | 7 ++++--- src/CSS/Text/Whitespace.purs | 4 ++-- src/CSS/TextAlign.purs | 4 ++-- src/CSS/Time.purs | 4 ++-- src/CSS/Transform.purs | 4 ++-- src/CSS/Transition.purs | 4 ++-- test/Main.purs | 8 ++++---- 31 files changed, 136 insertions(+), 130 deletions(-) diff --git a/.travis.yml b/.travis.yml index 15bacc0..e06d3f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,21 @@ language: node_js dist: trusty sudo: required -node_js: 6 +node_js: stable +env: + - PATH=$HOME/purescript:$PATH install: + - TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p') + - wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz + - tar -xvf $HOME/purescript.tar.gz -C $HOME/ + - chmod a+x $HOME/purescript - npm install -g bower - npm install script: - bower install --production - npm run -s build - bower install - - npm -s test + - npm test after_success: - >- test $TRAVIS_TAG && diff --git a/bower.json b/bower.json index 29a451e..0b5ef4b 100644 --- a/bower.json +++ b/bower.json @@ -21,16 +21,16 @@ "tests" ], "dependencies": { - "purescript-generics": "^4.0.0", - "purescript-nonempty": "^4.0.0", - "purescript-profunctor": "^3.0.0", - "purescript-strings": "^3.0.0", - "purescript-these": "^3.0.0", - "purescript-transformers": "^3.2.0", - "purescript-colors": "3.x - 4.x", - "purescript-console": "^3.0.0" + "purescript-generics-rep": "^6.0.0", + "purescript-nonempty": "^5.0.0", + "purescript-profunctor": "^4.0.0", + "purescript-strings": "^4.0.0", + "purescript-these": "^4.0.0", + "purescript-transformers": "^4.1.0", + "purescript-colors": "^5.0.0", + "purescript-console": "^4.1.0" }, "devDependencies": { - "purescript-exceptions": "^3.0.0" + "purescript-exceptions": "^4.0.0" } } diff --git a/package.json b/package.json index 83a2f57..5a4bff0 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,8 @@ "test": "pulp test" }, "devDependencies": { - "pulp": "^11.0.2", - "purescript-psa": "^0.5.1", - "purescript": "^0.11.6", - "rimraf": "^2.6.1" + "pulp": "^12.2.0", + "purescript-psa": "^0.6.0", + "rimraf": "^2.6.2" } } diff --git a/src/CSS/Animation.purs b/src/CSS/Animation.purs index ae4474e..b774508 100644 --- a/src/CSS/Animation.purs +++ b/src/CSS/Animation.purs @@ -7,14 +7,14 @@ import CSS.Stylesheet (CSS, key) import CSS.Time (Time) import CSS.Transition (TimingFunction) import Data.Foldable (for_) -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Tuple.Nested (tuple7) newtype AnimationDirection = AnimationDirection Value derive instance eqAnimationDirection :: Eq AnimationDirection derive instance ordAnimationDirection :: Ord AnimationDirection -derive instance genericAnimationDirection :: Generic AnimationDirection +derive instance genericAnimationDirection :: Generic AnimationDirection _ instance valAnimationDirection :: Val AnimationDirection where value (AnimationDirection v) = v @@ -35,7 +35,7 @@ newtype IterationCount = IterationCount Value derive instance eqIterationCount :: Eq IterationCount derive instance ordIterationCount :: Ord IterationCount -derive instance genericIterationCount :: Generic IterationCount +derive instance genericIterationCount :: Generic IterationCount _ instance valIterationCount :: Val IterationCount where value (IterationCount v) = v @@ -50,7 +50,7 @@ newtype FillMode = FillMode Value derive instance eqFillMode :: Eq FillMode derive instance ordFillMode :: Ord FillMode -derive instance genericFillMode :: Generic FillMode +derive instance genericFillMode :: Generic FillMode _ instance valFillMode :: Val FillMode where value (FillMode v) = v @@ -77,7 +77,7 @@ newtype AnimationName = AnimationName Value derive instance eqAnimationName :: Eq AnimationName derive instance ordAnimationName :: Ord AnimationName -derive instance genericAnimationName :: Generic AnimationName +derive instance genericAnimationName :: Generic AnimationName _ instance valAnimationName :: Val AnimationName where value (AnimationName v) = v diff --git a/src/CSS/Background.purs b/src/CSS/Background.purs index 2f95826..8df18de 100644 --- a/src/CSS/Background.purs +++ b/src/CSS/Background.purs @@ -75,7 +75,7 @@ where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Tuple (Tuple(..)) import CSS.Box (BoxType) @@ -135,7 +135,7 @@ newtype BackgroundPosition = BackgroundPosition Value derive instance eqBackgroundPosition :: Eq BackgroundPosition derive instance ordBackgroundPosition :: Ord BackgroundPosition -derive instance genericBackgroundPosition :: Generic BackgroundPosition +derive instance genericBackgroundPosition :: Generic BackgroundPosition _ instance isStringBackgroundPosition :: IsString BackgroundPosition where fromString = BackgroundPosition <<< fromString @@ -167,7 +167,7 @@ newtype BackgroundSize = BackgroundSize Value derive instance eqBackgroundSize :: Eq BackgroundSize derive instance ordBackgroundSize :: Ord BackgroundSize -derive instance genericBackgroundSize :: Generic BackgroundSize +derive instance genericBackgroundSize :: Generic BackgroundSize _ instance isStringBackgroundSize :: IsString BackgroundSize where fromString = BackgroundSize <<< fromString @@ -205,7 +205,7 @@ newtype BackgroundRepeat = BackgroundRepeat Value derive instance eqBackgroundRepeat :: Eq BackgroundRepeat derive instance ordBackgroundRepeat :: Ord BackgroundRepeat -derive instance genericBackgroundRepeat :: Generic BackgroundRepeat +derive instance genericBackgroundRepeat :: Generic BackgroundRepeat _ instance isStringBackgroundRepeat :: IsString BackgroundRepeat where fromString = BackgroundRepeat <<< fromString @@ -255,7 +255,7 @@ newtype BackgroundImage = BackgroundImage Value derive instance eqBackgroundImage :: Eq BackgroundImage derive instance ordBackgroundImage :: Ord BackgroundImage -derive instance genericBackgroundImage :: Generic BackgroundImage +derive instance genericBackgroundImage :: Generic BackgroundImage _ instance isStringBackgroundImage :: IsString BackgroundImage where fromString = BackgroundImage <<< fromString @@ -287,7 +287,7 @@ newtype BackgroundOrigin = BackgroundOrigin Value derive instance eqBackgroundOrigin :: Eq BackgroundOrigin derive instance ordBackgroundOrigin :: Ord BackgroundOrigin -derive instance genericBackgroundOrigin :: Generic BackgroundOrigin +derive instance genericBackgroundOrigin :: Generic BackgroundOrigin _ instance isStringBackgroundOrigin :: IsString BackgroundOrigin where fromString = BackgroundOrigin <<< fromString @@ -316,7 +316,7 @@ newtype BackgroundClip = BackgroundClip Value derive instance eqBackgroundClip :: Eq BackgroundClip derive instance ordBackgroundClip :: Ord BackgroundClip -derive instance genericBackgroundClip :: Generic BackgroundClip +derive instance genericBackgroundClip :: Generic BackgroundClip _ instance isStringBackgroundClip :: IsString BackgroundClip where fromString = BackgroundClip <<< fromString @@ -345,7 +345,7 @@ newtype BackgroundAttachment = BackgroundAttachment Value derive instance eqBackgroundAttachment :: Eq BackgroundAttachment derive instance ordBackgroundAttachment :: Ord BackgroundAttachment -derive instance genericBackgroundAttachment :: Generic BackgroundAttachment +derive instance genericBackgroundAttachment :: Generic BackgroundAttachment _ instance isStringBackgroundAttachment :: IsString BackgroundAttachment where fromString = BackgroundAttachment <<< fromString @@ -377,7 +377,7 @@ newtype Side = Side Value derive instance eqSide :: Eq Side derive instance ordSide :: Ord Side -derive instance genericSide :: Generic Side +derive instance genericSide :: Generic Side _ instance isStringSide :: IsString Side where fromString = Side <<< fromString @@ -418,7 +418,7 @@ newtype Direction = Direction Value derive instance eqDirection :: Eq Direction derive instance ordDirection :: Ord Direction -derive instance genericDirection :: Generic Direction +derive instance genericDirection :: Generic Direction _ instance valDirection :: Val Direction where value (Direction v) = v @@ -436,7 +436,7 @@ newtype Location = Location Value derive instance eqLocation :: Eq Location derive instance ordLocation :: Ord Location -derive instance genericLocation :: Generic Location +derive instance genericLocation :: Generic Location _ instance valLocation :: Val Location where value (Location v) = v diff --git a/src/CSS/Border.purs b/src/CSS/Border.purs index 5da1e80..33317ee 100644 --- a/src/CSS/Border.purs +++ b/src/CSS/Border.purs @@ -2,7 +2,7 @@ module CSS.Border where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Tuple.Nested (tuple3, tuple4) import CSS.Color (Color) @@ -15,7 +15,7 @@ newtype Stroke = Stroke Value derive instance eqStroke :: Eq Stroke derive instance ordStroke :: Ord Stroke -derive instance genericStroke :: Generic Stroke +derive instance genericStroke :: Generic Stroke _ instance valStroke :: Val Stroke where value (Stroke v) = v diff --git a/src/CSS/Box.purs b/src/CSS/Box.purs index 8a3c7e9..21cb5e5 100644 --- a/src/CSS/Box.purs +++ b/src/CSS/Box.purs @@ -9,7 +9,7 @@ where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.Border (Stroke) import CSS.Color (Color) @@ -25,7 +25,7 @@ newtype BoxType = BoxType Value derive instance eqBoxType :: Eq BoxType derive instance ordBoxType :: Ord BoxType -derive instance genericBoxType :: Generic BoxType +derive instance genericBoxType :: Generic BoxType _ instance isStringBoxType :: IsString BoxType where fromString = BoxType <<< fromString diff --git a/src/CSS/Common.purs b/src/CSS/Common.purs index 02faa42..994554e 100644 --- a/src/CSS/Common.purs +++ b/src/CSS/Common.purs @@ -7,8 +7,6 @@ module CSS.Common where import Prelude - -import Data.Monoid (class Monoid) import Data.Tuple (Tuple(..)) import CSS.Property (Prefixed(..), Value) @@ -47,7 +45,7 @@ instance normalValue :: Normal Value where normal = fromString "normal" instance noneValue :: None Value where none = fromString "none" instance visibleValue :: Visible Value where visible = fromString "visible" instance hiddenValue :: Hidden Value where hidden = fromString "hidden" -instance otherValue :: Other Value where other = id +instance otherValue :: Other Value where other = identity instance initialValue :: Initial Value where initial = fromString "initial" instance unsetValue :: Unset Value where unset = fromString "unset" instance topValue :: Top Value where top = fromString "top" diff --git a/src/CSS/Display.purs b/src/CSS/Display.purs index 492fd38..105b48b 100644 --- a/src/CSS/Display.purs +++ b/src/CSS/Display.purs @@ -1,17 +1,19 @@ module CSS.Display where import Prelude + import CSS.Common (class Inherit, class None) import CSS.Property (class Val, Value) import CSS.String (fromString) import CSS.Stylesheet (CSS, key) -import Data.Generic (class Generic, gShow) +import Data.Generic.Rep (class Generic) +import Data.Generic.Rep.Show (genericShow) newtype Position = Position Value derive instance eqPosition :: Eq Position derive instance ordPosition :: Ord Position -derive instance genericPosition :: Generic Position +derive instance genericPosition :: Generic Position _ instance valPosition :: Val Position where value (Position v) = v @@ -35,7 +37,7 @@ newtype Display = Display Value derive instance eqDisplay :: Eq Display derive instance ordDisplay :: Ord Display -derive instance genericDisplay :: Generic Display +derive instance genericDisplay :: Generic Display _ instance valDisplay :: Val Display where value (Display v) = v @@ -109,10 +111,10 @@ display = key $ fromString "display" data Float = FloatLeft | FloatRight | FloatNone derive instance eqFloat :: Eq Float -derive instance genericFloat :: Generic Float +derive instance genericFloat :: Generic Float _ instance showFloat :: Show Float where - show = gShow + show = genericShow instance valFloat :: Val (Float) where value (FloatLeft) = fromString "left" @@ -141,10 +143,10 @@ data ClearFloat | ClearFloatInlineEnd derive instance eqClearFloat :: Eq ClearFloat -derive instance genericClearFloat :: Generic ClearFloat +derive instance genericClearFloat :: Generic ClearFloat _ instance showClearFloat :: Show ClearFloat where - show = gShow + show = genericShow instance valClearFloat :: Val (ClearFloat) where value (ClearFloatLeft) = fromString "left" diff --git a/src/CSS/Flexbox.purs b/src/CSS/Flexbox.purs index a695b3d..4f909b6 100644 --- a/src/CSS/Flexbox.purs +++ b/src/CSS/Flexbox.purs @@ -4,7 +4,7 @@ module CSS.Flexbox where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.Common (class Center, class Inherit, class Other, class Baseline, class Auto) import CSS.Property (class Val, Value, value, (!)) @@ -48,7 +48,7 @@ newtype AlignContentValue = AlignContentValue Value derive instance eqAlignContentValue :: Eq AlignContentValue derive instance ordAlignContentValue :: Ord AlignContentValue -derive instance genericAlignContentValue :: Generic AlignContentValue +derive instance genericAlignContentValue :: Generic AlignContentValue _ instance isStringAlignContentValue :: IsString AlignContentValue where fromString = AlignContentValue <<< fromString @@ -89,7 +89,7 @@ newtype AlignItemsValue = AlignItemsValue Value derive instance eqAlignItemsValue :: Eq AlignItemsValue derive instance ordAlignItemsValue :: Ord AlignItemsValue -derive instance genericAlignItemsValue :: Generic AlignItemsValue +derive instance genericAlignItemsValue :: Generic AlignItemsValue _ instance isStringAlignItemsValue :: IsString AlignItemsValue where fromString = AlignItemsValue <<< fromString @@ -127,7 +127,7 @@ newtype AlignSelfValue = AlignSelfValue Value derive instance eqAlignSelfValue :: Eq AlignSelfValue derive instance ordAlignSelfValue :: Ord AlignSelfValue -derive instance genericAlignSelfValue :: Generic AlignSelfValue +derive instance genericAlignSelfValue :: Generic AlignSelfValue _ instance isStringAlignSelfValue :: IsString AlignSelfValue where fromString = AlignSelfValue <<< fromString @@ -180,7 +180,7 @@ newtype FlexDirection = FlexDirection Value derive instance eqFlexDirection :: Eq FlexDirection derive instance ordFlexDirection :: Ord FlexDirection -derive instance genericFlexDirection :: Generic FlexDirection +derive instance genericFlexDirection :: Generic FlexDirection _ instance valFlexDirection :: Val FlexDirection where value (FlexDirection v) = v @@ -222,7 +222,7 @@ newtype FlexWrap = FlexWrap Value derive instance eqFlexWrap :: Eq FlexWrap derive instance ordFlexWrap :: Ord FlexWrap -derive instance genericFlexWrap :: Generic FlexWrap +derive instance genericFlexWrap :: Generic FlexWrap _ instance valFlexWrap :: Val FlexWrap where value (FlexWrap v) = v @@ -248,7 +248,7 @@ newtype JustifyContentValue = JustifyContentValue Value derive instance eqJustifyContentValue :: Eq JustifyContentValue derive instance ordJustifyContentValue :: Ord JustifyContentValue -derive instance genericJustifyContentValue :: Generic JustifyContentValue +derive instance genericJustifyContentValue :: Generic JustifyContentValue _ instance isStringJustifyContentValue :: IsString JustifyContentValue where fromString = JustifyContentValue <<< fromString diff --git a/src/CSS/Font.purs b/src/CSS/Font.purs index 55c7dc9..f78c423 100644 --- a/src/CSS/Font.purs +++ b/src/CSS/Font.purs @@ -7,7 +7,7 @@ import CSS.Property (class Val, Value, value, quote) import CSS.Size (Size) import CSS.String (fromString) import CSS.Stylesheet (CSS, key) -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.NonEmpty (NonEmpty, oneOf) color :: Color -> CSS @@ -17,7 +17,7 @@ newtype GenericFontFamily = GenericFontFamily Value derive instance eqGenericFontFamily :: Eq GenericFontFamily derive instance ordGenericFontFamily :: Ord GenericFontFamily -derive instance genericGenericFontFamily :: Generic GenericFontFamily +derive instance genericGenericFontFamily :: Generic GenericFontFamily _ instance valGenericFontFamily :: Val GenericFontFamily where value (GenericFontFamily v) = v @@ -35,7 +35,7 @@ newtype FontWeight = FontWeight Value derive instance eqFontWeight :: Eq FontWeight derive instance ordFontWeight :: Ord FontWeight -derive instance genericFontWeight :: Generic FontWeight +derive instance genericFontWeight :: Generic FontWeight _ instance valFontWeight :: Val FontWeight where value (FontWeight v) = v @@ -71,7 +71,7 @@ newtype FontStyle = FontStyle Value derive instance eqFontStyle :: Eq FontStyle derive instance ordFontStyle :: Ord FontStyle -derive instance genericFontStyle :: Generic FontStyle +derive instance genericFontStyle :: Generic FontStyle _ instance valFontStyle :: Val FontStyle where value (FontStyle v) = v diff --git a/src/CSS/FontFace.purs b/src/CSS/FontFace.purs index 6c46402..c1115be 100644 --- a/src/CSS/FontFace.purs +++ b/src/CSS/FontFace.purs @@ -2,7 +2,7 @@ module CSS.FontFace where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Maybe (Maybe, maybe) import Data.NonEmpty (NonEmpty) @@ -23,7 +23,7 @@ data FontFaceFormat derive instance eqFontFaceFormat :: Eq FontFaceFormat derive instance ordFontFaceFormat :: Ord FontFaceFormat -derive instance genericFontFaceFormat :: Generic FontFaceFormat +derive instance genericFontFaceFormat :: Generic FontFaceFormat _ formatName :: FontFaceFormat -> String formatName WOFF = "woff" @@ -39,7 +39,7 @@ data FontFaceSrc derive instance eqFontFaceSrc :: Eq FontFaceSrc derive instance ordFontFaceSrc :: Ord FontFaceSrc -derive instance genericFontFaceSrc :: Generic FontFaceSrc +derive instance genericFontFaceSrc :: Generic FontFaceSrc _ instance valFontFaceSrc :: Val FontFaceSrc where value (FontFaceSrcUrl u f) = fromString $ "url(" <> quote u <> ")" <> maybe "" (\f' -> " format(" <> quote (formatName f') <> ")") f diff --git a/src/CSS/Gradient.purs b/src/CSS/Gradient.purs index 216a421..3f1d419 100644 --- a/src/CSS/Gradient.purs +++ b/src/CSS/Gradient.purs @@ -29,7 +29,7 @@ where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Tuple (Tuple(..)) import CSS.Background (class Loc, BackgroundImage, Direction, sideTop, straight, sideLeft) @@ -89,7 +89,7 @@ newtype Radial = Radial Value derive instance eqRadial :: Eq Radial derive instance ordRadial :: Ord Radial -derive instance genericRadial :: Generic Radial +derive instance genericRadial :: Generic Radial _ instance valRadial :: Val Radial where value (Radial v) = v @@ -113,7 +113,7 @@ newtype Extend = Extend Value derive instance eqExtend :: Eq Extend derive instance ordExtend :: Ord Extend -derive instance genericExtend :: Generic Extend +derive instance genericExtend :: Generic Extend _ instance valExtend :: Val Extend where value (Extend v) = v diff --git a/src/CSS/ListStyle/Image.purs b/src/CSS/ListStyle/Image.purs index 001b27f..47507fd 100644 --- a/src/CSS/ListStyle/Image.purs +++ b/src/CSS/ListStyle/Image.purs @@ -6,7 +6,8 @@ import CSS.String (fromString) import CSS.Stylesheet (CSS, key) import Data.Eq (class Eq) import Data.Function (($)) -import Data.Generic (class Generic, gShow) +import Data.Generic.Rep (class Generic) +import Data.Generic.Rep.Show (genericShow) import Data.Ord (class Ord) import Data.Semigroup ((<>)) import Data.Show (class Show) @@ -20,10 +21,10 @@ data ListStyleImage derive instance eqListStyleImage :: Eq ListStyleImage derive instance ordListStyleImage :: Ord ListStyleImage -derive instance genericListStyleImage :: Generic ListStyleImage +derive instance genericListStyleImage :: Generic ListStyleImage _ instance showListStyleImage :: Show ListStyleImage where - show = gShow + show = genericShow instance valListStyleImage :: Val ListStyleImage where value (Initial) = fromString "initial" diff --git a/src/CSS/ListStyle/Position.purs b/src/CSS/ListStyle/Position.purs index c74acbf..1b26442 100644 --- a/src/CSS/ListStyle/Position.purs +++ b/src/CSS/ListStyle/Position.purs @@ -6,7 +6,8 @@ import CSS.String (fromString) import CSS.Stylesheet (CSS, key) import Data.Eq (class Eq) import Data.Function (($)) -import Data.Generic (class Generic, gShow) +import Data.Generic.Rep (class Generic) +import Data.Generic.Rep.Show (genericShow) import Data.Ord (class Ord) import Data.Show (class Show) @@ -19,10 +20,10 @@ data ListStylePosition derive instance eqListStylePosition :: Eq ListStylePosition derive instance ordListStylePosition :: Ord ListStylePosition -derive instance genericListStylePosition :: Generic ListStylePosition +derive instance genericListStylePosition :: Generic ListStylePosition _ instance showListStylePosition :: Show ListStylePosition where - show = gShow + show = genericShow instance valListStylePosition :: Val ListStylePosition where value (Inside) = fromString "inside" diff --git a/src/CSS/ListStyle/Type.purs b/src/CSS/ListStyle/Type.purs index 2c7c530..8aee9b2 100644 --- a/src/CSS/ListStyle/Type.purs +++ b/src/CSS/ListStyle/Type.purs @@ -6,7 +6,8 @@ import CSS.String (fromString) import CSS.Stylesheet (CSS, key) import Data.Eq (class Eq) import Data.Function (($)) -import Data.Generic (class Generic, gShow) +import Data.Generic.Rep (class Generic) +import Data.Generic.Rep.Show (genericShow) import Data.Ord (class Ord) import Data.Semigroup ((<>)) import Data.Show (class Show) @@ -28,10 +29,10 @@ data ListStyleType derive instance eqListStyleType :: Eq ListStyleType derive instance ordListStyleType :: Ord ListStyleType -derive instance genericListStyleType :: Generic ListStyleType +derive instance genericListStyleType :: Generic ListStyleType _ instance showListStyleType :: Show ListStyleType where - show = gShow + show = genericShow instance valListStyleType :: Val ListStyleType where value (Disc) = fromString "disc" diff --git a/src/CSS/Overflow.purs b/src/CSS/Overflow.purs index a7d5c4d..7147b59 100644 --- a/src/CSS/Overflow.purs +++ b/src/CSS/Overflow.purs @@ -2,7 +2,7 @@ module CSS.Overflow where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.Property (class Val, Value) import CSS.String (fromString) @@ -12,7 +12,7 @@ newtype Overflow = Overflow Value derive instance eqOverflow :: Eq Overflow derive instance ordOverflow :: Ord Overflow -derive instance genericOverflow :: Generic Overflow +derive instance genericOverflow :: Generic Overflow _ instance valOverflow :: Val Overflow where value (Overflow v) = v diff --git a/src/CSS/Property.purs b/src/CSS/Property.purs index 05371c7..825f744 100644 --- a/src/CSS/Property.purs +++ b/src/CSS/Property.purs @@ -1,12 +1,12 @@ module CSS.Property where import Prelude + import CSS.String (class IsString, fromString) import Color (Color, cssStringHSLA) import Data.Foldable (intercalate) -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Maybe (fromMaybe) -import Data.Monoid (class Monoid, mempty) import Data.NonEmpty (NonEmpty, oneOf) import Data.Profunctor.Strong (second) import Data.Tuple (Tuple(..), lookup) @@ -17,7 +17,7 @@ data Prefixed derive instance eqPrefixed :: Eq Prefixed derive instance ordPrefixed :: Ord Prefixed -derive instance genericPrefixed :: Generic Prefixed +derive instance genericPrefixed :: Generic Prefixed _ instance isStringPrefixed :: IsString Prefixed where fromString = Plain @@ -43,7 +43,7 @@ newtype Key a = Key Prefixed derive instance eqKey :: (Eq a) => Eq (Key a) derive instance ordKey :: (Ord a) => Ord (Key a) -derive instance genericKey :: (Generic a) => Generic (Key a) +derive instance genericKey :: (Generic a rep) => Generic (Key a) _ instance isStringKey :: IsString (Key a) where fromString = Key <<< fromString @@ -55,7 +55,7 @@ newtype Value = Value Prefixed derive instance eqValue :: Eq Value derive instance ordValue :: Ord Value -derive instance genericValue :: Generic Value +derive instance genericValue :: Generic Value _ instance isStringValue :: IsString Value where fromString = Value <<< fromString @@ -73,13 +73,13 @@ newtype Literal = Literal String derive instance eqLiteral :: Eq Literal derive instance ordLiteral :: Ord Literal -derive instance genericLiteral :: Generic Literal +derive instance genericLiteral :: Generic Literal _ instance valLiteral :: Val Literal where value (Literal a) = fromString $ quote a instance valValue :: Val Value where - value = id + value = identity instance valString :: Val String where value = fromString diff --git a/src/CSS/Render.purs b/src/CSS/Render.purs index 2a0e884..4adc6b3 100644 --- a/src/CSS/Render.purs +++ b/src/CSS/Render.purs @@ -2,29 +2,26 @@ module CSS.Render where import Prelude -import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Console (log, CONSOLE) - +import CSS.Property (Key(..), Prefixed(..), Value(..), plain) +import CSS.Selector (Path(..), Predicate(..), Refinement(..), Selector(..), with, star, element, (**), (|>)) +import CSS.String (fromString) +import CSS.Stylesheet (CSS, StyleM, App(..), Feature(..), Keyframes(..), MediaQuery(..), MediaType(..), Rule(..), runS) import Data.Array (null, (:), drop, sort, uncons, mapMaybe) import Data.Either (Either(..), either) import Data.Foldable (fold, foldMap, intercalate) -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Maybe (Maybe(..), fromMaybe, maybe) -import Data.Monoid (class Monoid, mempty) import Data.NonEmpty (NonEmpty(..), (:|), foldl1, oneOf) import Data.These (These(..), theseLeft, theseRight) import Data.Tuple (Tuple(..), lookup, uncurry) - -import CSS.Property (Key(..), Prefixed(..), Value(..), plain) -import CSS.Selector (Path(..), Predicate(..), Refinement(..), Selector(..), with, star, element, (**), (|>)) -import CSS.String (fromString) -import CSS.Stylesheet (CSS, StyleM, App(..), Feature(..), Keyframes(..), MediaQuery(..), MediaType(..), Rule(..), runS) +import Effect (Effect) +import Effect.Console (log) newtype Inline = Inline String derive instance eqInline :: Eq Inline derive instance ordInline :: Ord Inline -derive instance genericInline :: Generic Inline +derive instance genericInline :: Generic Inline _ getInline :: Inline -> String getInline (Inline s) = s @@ -39,7 +36,7 @@ newtype Sheet = Sheet String derive instance eqSheet :: Eq Sheet derive instance ordSheet :: Ord Sheet -derive instance genericSheet :: Generic Sheet +derive instance genericSheet :: Generic Sheet _ getSheet :: Sheet -> String getSheet (Sheet s) = s @@ -61,11 +58,11 @@ renderedSheet = (_ >>= (map getSheet <<< theseRight)) render :: forall a. StyleM a -> Rendered render = rules [] <<< runS -putInline :: forall e. CSS -> Eff (console :: CONSOLE | e) Unit +putInline :: CSS -> Effect Unit putInline s = log <<< fromMaybe "" <<< renderedInline <<< render $ s -putStyleSheet :: forall e. CSS -> Eff (console :: CONSOLE | e) Unit +putStyleSheet :: CSS -> Effect Unit putStyleSheet s = log <<< fromMaybe "" <<< renderedSheet <<< render $ s diff --git a/src/CSS/Selector.purs b/src/CSS/Selector.purs index 9b9b883..05ebad7 100644 --- a/src/CSS/Selector.purs +++ b/src/CSS/Selector.purs @@ -2,7 +2,7 @@ module CSS.Selector where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.String (take, drop) import CSS.String (class IsString) @@ -22,13 +22,13 @@ data Predicate derive instance eqPredicate :: Eq Predicate derive instance ordPredicate :: Ord Predicate -derive instance genericPredicate :: Generic Predicate +derive instance genericPredicate :: Generic Predicate _ newtype Refinement = Refinement (Array Predicate) derive instance eqRefinement :: Eq Refinement derive instance ordRefinement :: Ord Refinement -derive instance genericRefinement :: Generic Refinement +derive instance genericRefinement :: Generic Refinement _ instance isStringRefinement :: IsString Refinement where fromString s = @@ -51,13 +51,13 @@ data Path f derive instance eqPath :: (Eq f) => Eq (Path f) derive instance ordPath :: (Ord f) => Ord (Path f) -derive instance genericPath :: (Generic f) => Generic (Path f) +derive instance genericPath :: (Generic f rep) => Generic (Path f) _ data Selector = Selector Refinement (Path Selector) derive instance eqSelector :: Eq Selector derive instance ordSelector :: Ord Selector -derive instance genericSelector :: Generic Selector +derive instance genericSelector :: Generic Selector _ instance isStringSelector :: IsString Selector where fromString s = diff --git a/src/CSS/Size.purs b/src/CSS/Size.purs index e7b0c85..b8cd804 100644 --- a/src/CSS/Size.purs +++ b/src/CSS/Size.purs @@ -2,7 +2,7 @@ module CSS.Size where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.Common (class Auto) import CSS.Property (class Val, Value, value) @@ -12,7 +12,7 @@ newtype Size a = Size Value derive instance eqSize :: Eq a => Eq (Size a) derive instance ordSize :: Ord a => Ord (Size a) -derive instance genericSize :: Generic a => Generic (Size a) +derive instance genericSize :: Generic a rep => Generic (Size a) _ instance isStringSize :: IsString (Size a) where fromString = Size <<< fromString @@ -69,7 +69,7 @@ newtype Angle a = Angle Value derive instance eqAngle :: Eq a => Eq (Angle a) derive instance ordAngle :: Ord a => Ord (Angle a) -derive instance genericAngle :: Generic a => Generic (Angle a) +derive instance genericAngle :: Generic a rep => Generic (Angle a) _ instance valAngle :: Val (Angle a) where value (Angle v) = v diff --git a/src/CSS/String.purs b/src/CSS/String.purs index 3066a94..c5208bb 100644 --- a/src/CSS/String.purs +++ b/src/CSS/String.purs @@ -6,4 +6,4 @@ class IsString s where fromString :: String -> s instance isStringString :: IsString String where - fromString = id + fromString = identity diff --git a/src/CSS/Stylesheet.purs b/src/CSS/Stylesheet.purs index f8d1703..2e2a6e8 100644 --- a/src/CSS/Stylesheet.purs +++ b/src/CSS/Stylesheet.purs @@ -6,7 +6,7 @@ import Control.Monad.Writer (Writer, execWriter) import Control.Monad.Writer.Class (tell) import Data.Array (singleton) -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Maybe (Maybe(..)) import Data.NonEmpty (NonEmpty, (:|)) import Data.Profunctor.Strong (second) @@ -19,25 +19,25 @@ newtype MediaType = MediaType Value derive instance eqMediaType :: Eq MediaType derive instance ordMediaType:: Ord MediaType -derive instance genericMediaType :: Generic MediaType +derive instance genericMediaType :: Generic MediaType _ data NotOrOnly = Not | Only derive instance eqNotOrOnly :: Eq NotOrOnly derive instance ordNotOrOnly:: Ord NotOrOnly -derive instance genericNotOrOnly :: Generic NotOrOnly +derive instance genericNotOrOnly :: Generic NotOrOnly _ data MediaQuery = MediaQuery (Maybe NotOrOnly) MediaType (NonEmpty Array Feature) derive instance eqMediaQuery :: Eq MediaQuery derive instance ordMediaQuery :: Ord MediaQuery -derive instance genericMediaQuery :: Generic MediaQuery +derive instance genericMediaQuery :: Generic MediaQuery _ data Feature = Feature String (Maybe Value) derive instance eqFeature :: Eq Feature derive instance ordFeature :: Ord Feature -derive instance genericFeature :: Generic Feature +derive instance genericFeature :: Generic Feature _ data App = Self Refinement @@ -48,13 +48,13 @@ data App derive instance eqApp :: Eq App derive instance ordApp :: Ord App -derive instance genericApp :: Generic App +derive instance genericApp :: Generic App _ data Keyframes = Keyframes String (NonEmpty Array (Tuple Number (Array Rule))) derive instance eqKeyframes :: Eq Keyframes derive instance ordKeyframes :: Ord Keyframes -derive instance genericKeyframes :: Generic Keyframes +derive instance genericKeyframes :: Generic Keyframes _ data Rule = Property (Key Unit) Value @@ -66,7 +66,7 @@ data Rule derive instance eqRule :: Eq Rule derive instance ordRule :: Ord Rule -derive instance genericRule :: Generic Rule +derive instance genericRule :: Generic Rule _ newtype StyleM a = S (Writer (Array Rule) a) diff --git a/src/CSS/Text.purs b/src/CSS/Text.purs index 0396285..10c181e 100644 --- a/src/CSS/Text.purs +++ b/src/CSS/Text.purs @@ -5,7 +5,7 @@ import CSS.Property (class Val, Value) import CSS.Size (Size) import CSS.String (fromString) import CSS.Stylesheet (CSS, key) -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) letterSpacing :: forall a. Size a -> CSS letterSpacing = key $ fromString "letter-spacing" @@ -14,7 +14,7 @@ newtype TextDecoration = TextDecoration Value derive instance eqTextDecoration :: Eq TextDecoration derive instance ordTextDecoration:: Ord TextDecoration -derive instance genericTextDecoration :: Generic TextDecoration +derive instance genericTextDecoration :: Generic TextDecoration _ instance valTextDecoration :: Val TextDecoration where value (TextDecoration v) = v diff --git a/src/CSS/Text/Transform.purs b/src/CSS/Text/Transform.purs index e48d73c..4e59779 100644 --- a/src/CSS/Text/Transform.purs +++ b/src/CSS/Text/Transform.purs @@ -12,7 +12,8 @@ import CSS.String (fromString) import CSS.Stylesheet (CSS, key) import Data.Eq (class Eq) import Data.Function (($)) -import Data.Generic (class Generic, gShow) +import Data.Generic.Rep (class Generic) +import Data.Generic.Rep.Show (genericShow) import Data.Ord (class Ord) import Data.Show (class Show) @@ -26,7 +27,7 @@ data TextTransform derive instance eqTextTransform :: Eq TextTransform derive instance ordTextTransform :: Ord TextTransform -derive instance genericTextTransform :: Generic TextTransform +derive instance genericTextTransform :: Generic TextTransform _ instance valTextTransform :: Val TextTransform where value (Uppercase) = fromString "uppercase" @@ -37,7 +38,7 @@ instance valTextTransform :: Val TextTransform where value (Inherit) = fromString "inherit" instance showTextTransform :: Show (TextTransform) where - show = gShow + show = genericShow instance noneTextTransform :: None TextTransform where none = None diff --git a/src/CSS/Text/Whitespace.purs b/src/CSS/Text/Whitespace.purs index de80944..4dab8be 100644 --- a/src/CSS/Text/Whitespace.purs +++ b/src/CSS/Text/Whitespace.purs @@ -10,7 +10,7 @@ module CSS.Text.Whitespace import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.Property (class Val, Value) import CSS.String (fromString) @@ -20,7 +20,7 @@ newtype TextWhitespace = TextWhitespace Value derive instance eqTextWhitespace :: Eq TextWhitespace derive instance ordTextWhitespace :: Ord TextWhitespace -derive instance genericTextWhitespace :: Generic TextWhitespace +derive instance genericTextWhitespace :: Generic TextWhitespace _ instance valTextWhitespace :: Val TextWhitespace where value (TextWhitespace v) = v diff --git a/src/CSS/TextAlign.purs b/src/CSS/TextAlign.purs index 021b1f6..e17cca5 100644 --- a/src/CSS/TextAlign.purs +++ b/src/CSS/TextAlign.purs @@ -2,7 +2,7 @@ module CSS.TextAlign where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.Property (class Val, Value) import CSS.String (fromString) @@ -12,7 +12,7 @@ newtype TextAlign = TextAlign Value derive instance eqTextAlign :: Eq TextAlign derive instance ordTextAlign:: Ord TextAlign -derive instance genericTextAlign :: Generic TextAlign +derive instance genericTextAlign :: Generic TextAlign _ instance valTextAlign :: Val TextAlign where value (TextAlign v) = v diff --git a/src/CSS/Time.purs b/src/CSS/Time.purs index 8817f43..4fde9f6 100644 --- a/src/CSS/Time.purs +++ b/src/CSS/Time.purs @@ -2,7 +2,7 @@ module CSS.Time where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.Property (class Val, Value, value) import CSS.String (fromString) @@ -11,7 +11,7 @@ newtype Time = Time Value derive instance eqTime :: Eq Time derive instance ordTime:: Ord Time -derive instance genericTime :: Generic Time +derive instance genericTime :: Generic Time _ instance valTime :: Val Time where value (Time v) = v diff --git a/src/CSS/Transform.purs b/src/CSS/Transform.purs index f4ebace..bd51ee7 100644 --- a/src/CSS/Transform.purs +++ b/src/CSS/Transform.purs @@ -6,14 +6,14 @@ import CSS.Property (class Val, Value, noCommas, value) import CSS.Size (Angle, Abs, Size) import CSS.String (fromString) import CSS.Stylesheet (CSS, key) -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import Data.Tuple.Nested (tuple3) newtype Transformation = Transformation Value derive instance eqTransformation :: Eq Transformation derive instance ordTransformation:: Ord Transformation -derive instance genericTransformation :: Generic Transformation +derive instance genericTransformation :: Generic Transformation _ instance valTransformation :: Val Transformation where value (Transformation v) = v diff --git a/src/CSS/Transition.purs b/src/CSS/Transition.purs index 69e74ab..ab61079 100644 --- a/src/CSS/Transition.purs +++ b/src/CSS/Transition.purs @@ -2,7 +2,7 @@ module CSS.Transition where import Prelude -import Data.Generic (class Generic) +import Data.Generic.Rep (class Generic) import CSS.String (fromString) import CSS.Property (class Val, Value) @@ -11,7 +11,7 @@ newtype TimingFunction = TimingFunction Value derive instance eqTimingFunction :: Eq TimingFunction derive instance ordTimingFunction:: Ord TimingFunction -derive instance genericTimingFunction :: Generic TimingFunction +derive instance genericTimingFunction :: Generic TimingFunction _ instance valTimingFunction :: Val TimingFunction where value (TimingFunction v) = v diff --git a/test/Main.purs b/test/Main.purs index a71e9be..ed5214e 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -2,8 +2,8 @@ module Test.Main where import Prelude -import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Exception (EXCEPTION, error, throwException) +import Effect (Effect) +import Effect.Exception (error, throwException) import CSS (Rendered, Path(..), Predicate(..), Refinement(..), Selector(..), FontFaceSrc(..), FontFaceFormat(..), renderedSheet, renderedInline, fromString, selector, block, display, render, borderBox, boxSizing, contentBox, blue, color, body, px, dashed, border, inlineBlock, red, (?), fontFaceSrc, zIndex) import Data.Maybe (Maybe(..)) import Data.NonEmpty (singleton) @@ -52,10 +52,10 @@ nestedNodesWithEmptyParent = render do fromString "#parent" ? do fromString "#child" ? display block -assertEqual :: forall a. Eq a => Show a => a -> a -> Eff (exception :: EXCEPTION) Unit +assertEqual :: forall a. Eq a => Show a => a -> a -> Effect Unit assertEqual x y = unless (x == y) <<< throwException <<< error $ "Assertion failed: " <> show x <> " /= " <> show y -main :: Eff (exception :: EXCEPTION) Unit +main :: Effect Unit main = do renderedInline example1 `assertEqual` Just "color: hsl(0.0, 100.0%, 50.0%); display: block" renderedInline example2 `assertEqual` Just "display: inline-block" From 2909c3db0ee21dc3d10695fea577b08e09aaed24 Mon Sep 17 00:00:00 2001 From: Maxim Zimaliev Date: Tue, 5 Jun 2018 21:18:29 +0300 Subject: [PATCH 2/2] added purescript node dep --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 5a4bff0..1b75ef9 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "devDependencies": { "pulp": "^12.2.0", "purescript-psa": "^0.6.0", + "purescript": "slamdata/node-purescript#0.12", "rimraf": "^2.6.2" } }