From 04d8225b6ac6ce0b7872c478bbd75b83a7cbc394 Mon Sep 17 00:00:00 2001 From: Miles Frain Date: Sat, 23 May 2020 09:45:43 -0600 Subject: [PATCH 1/3] Add common PropName, AttrName, ClassName --- src/Web/HTML.purs | 1 + src/Web/HTML/Common.purs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/Web/HTML/Common.purs diff --git a/src/Web/HTML.purs b/src/Web/HTML.purs index 16172e9..ae31a1f 100644 --- a/src/Web/HTML.purs +++ b/src/Web/HTML.purs @@ -5,6 +5,7 @@ module Web.HTML import Effect (Effect) import Web.HTML.Window (Window) +import Web.HTML.Common (PropName, AttrName, ClassName) as Exports import Web.HTML.History (History) as Exports import Web.HTML.HTMLAnchorElement (HTMLAnchorElement) as Exports import Web.HTML.HTMLAreaElement (HTMLAreaElement) as Exports diff --git a/src/Web/HTML/Common.purs b/src/Web/HTML/Common.purs new file mode 100644 index 0000000..667044a --- /dev/null +++ b/src/Web/HTML/Common.purs @@ -0,0 +1,30 @@ +module Web.HTML.Common where + +import Prelude + +import Data.Newtype (class Newtype) + +-- | A type-safe wrapper for property names. +-- | +-- | The phantom type `value` describes the type of value which this property +-- | requires. +newtype PropName value = PropName String + +derive instance newtypePropName :: Newtype (PropName value) _ +derive newtype instance eqPropName :: Eq (PropName value) +derive newtype instance ordPropName :: Ord (PropName value) + +-- | A type-safe wrapper for attribute names. +newtype AttrName = AttrName String + +derive instance newtypeAttrName :: Newtype AttrName _ +derive newtype instance eqAttrName :: Eq AttrName +derive newtype instance ordAttrName :: Ord AttrName + +-- | A wrapper for strings which are used as CSS classes. +newtype ClassName = ClassName String + +derive instance newtypeClassName :: Newtype ClassName _ +derive newtype instance eqClassName :: Eq ClassName +derive newtype instance ordClassName :: Ord ClassName +derive newtype instance semigroupClassName :: Semigroup ClassName \ No newline at end of file From 1af56befb722ae4daa5879c5a8247c4df066c596 Mon Sep 17 00:00:00 2001 From: milesfrain Date: Fri, 11 Dec 2020 13:15:38 -0800 Subject: [PATCH 2/3] Review feedback: Remove Semigroup ClassName, remove type-safe phrasing --- src/Web/HTML/Common.purs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Web/HTML/Common.purs b/src/Web/HTML/Common.purs index 667044a..c5d4732 100644 --- a/src/Web/HTML/Common.purs +++ b/src/Web/HTML/Common.purs @@ -4,7 +4,7 @@ import Prelude import Data.Newtype (class Newtype) --- | A type-safe wrapper for property names. +-- | A wrapper for property names. -- | -- | The phantom type `value` describes the type of value which this property -- | requires. @@ -14,7 +14,7 @@ derive instance newtypePropName :: Newtype (PropName value) _ derive newtype instance eqPropName :: Eq (PropName value) derive newtype instance ordPropName :: Ord (PropName value) --- | A type-safe wrapper for attribute names. +-- | A wrapper for attribute names. newtype AttrName = AttrName String derive instance newtypeAttrName :: Newtype AttrName _ @@ -27,4 +27,3 @@ newtype ClassName = ClassName String derive instance newtypeClassName :: Newtype ClassName _ derive newtype instance eqClassName :: Eq ClassName derive newtype instance ordClassName :: Ord ClassName -derive newtype instance semigroupClassName :: Semigroup ClassName \ No newline at end of file From 972111b4112c1f4d347effb71127a88a1bcebecf Mon Sep 17 00:00:00 2001 From: milesfrain Date: Fri, 11 Dec 2020 14:12:03 -0800 Subject: [PATCH 3/3] Fix PropName CI error --- src/Web/HTML/Common.purs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Web/HTML/Common.purs b/src/Web/HTML/Common.purs index c5d4732..6e5d8fa 100644 --- a/src/Web/HTML/Common.purs +++ b/src/Web/HTML/Common.purs @@ -8,6 +8,7 @@ import Data.Newtype (class Newtype) -- | -- | The phantom type `value` describes the type of value which this property -- | requires. +newtype PropName :: Type -> Type newtype PropName value = PropName String derive instance newtypePropName :: Newtype (PropName value) _ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy