From 147c5521669c1ffa9d4969e3ecdadbc44b0d02ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20D=C3=BChr?= Date: Sun, 11 Dec 2022 12:56:00 +0100 Subject: [PATCH 1/2] Project migrated from bower to spago --- .gitignore | 1 + bower.json | 23 ----------- packages.dhall | 105 +++++++++++++++++++++++++++++++++++++++++++++++ spago.dhall | 32 +++++++++++++++ src/SumType.purs | 16 +++----- test/Main.purs | 11 +++++ 6 files changed, 155 insertions(+), 33 deletions(-) delete mode 100644 bower.json create mode 100644 packages.dhall create mode 100644 spago.dhall create mode 100644 test/Main.purs diff --git a/.gitignore b/.gitignore index ce25bb8..5bf1410 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /generated-docs/ /.psc* /.psa* +/.spago/ \ No newline at end of file diff --git a/bower.json b/bower.json deleted file mode 100644 index 3e5d69d..0000000 --- a/bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "purescript-lenses", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "output" - ], - "dependencies": { - "purescript-prelude": "^4.0.1", - "purescript-console": "^4.1.0", - "purescript-effect": "^2.0.0", - "purescript-profunctor-lenses": "^4.0.0", - "purescript-colors": "^5.0.0", - "purescript-random": "^4.0.0", - "purescript-record-extra": "^1.0.0", - "purescript-foreign-object": "^1.0.0", - "purescript-generics-rep": "^6.0.0" - }, - "devDependencies": { - "purescript-psci-support": "^4.0.0" - } -} diff --git a/packages.dhall b/packages.dhall new file mode 100644 index 0000000..5ba2a63 --- /dev/null +++ b/packages.dhall @@ -0,0 +1,105 @@ +{- +Welcome to your new Dhall package-set! + +Below are instructions for how to edit this file for most use +cases, so that you don't need to know Dhall to use it. + +## Use Cases + +Most will want to do one or both of these options: +1. Override/Patch a package's dependency +2. Add a package not already in the default package set + +This file will continue to work whether you use one or both options. +Instructions for each option are explained below. + +### Overriding/Patching a package + +Purpose: +- Change a package's dependency to a newer/older release than the + default package set's release +- Use your own modified version of some dependency that may + include new API, changed API, removed API by + using your custom git repo of the library rather than + the package set's repo + +Syntax: +where `entityName` is one of the following: +- dependencies +- repo +- version +------------------------------- +let upstream = -- +in upstream + with packageName.entityName = "new value" +------------------------------- + +Example: +------------------------------- +let upstream = -- +in upstream + with halogen.version = "master" + with halogen.repo = "https://example.com/path/to/git/repo.git" + + with halogen-vdom.version = "v4.0.0" + with halogen-vdom.dependencies = [ "extra-dependency" ] # halogen-vdom.dependencies +------------------------------- + +### Additions + +Purpose: +- Add packages that aren't already included in the default package set + +Syntax: +where `` is: +- a tag (i.e. "v4.0.0") +- a branch (i.e. "master") +- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977") +------------------------------- +let upstream = -- +in upstream + with new-package-name = + { dependencies = + [ "dependency1" + , "dependency2" + ] + , repo = + "https://example.com/path/to/git/repo.git" + , version = + "" + } +------------------------------- + +Example: +------------------------------- +let upstream = -- +in upstream + with benchotron = + { dependencies = + [ "arrays" + , "exists" + , "profunctor" + , "strings" + , "quickcheck" + , "lcg" + , "transformers" + , "foldable-traversable" + , "exceptions" + , "node-fs" + , "node-buffer" + , "node-readline" + , "datetime" + , "now" + ] + , repo = + "https://github.com/hdgarrood/purescript-benchotron.git" + , version = + "v7.0.0" + } +------------------------------- +-} +let upstream = + https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20221211/packages.dhall + sha256:d115f153861ffe27fafa4afa1d337d4fc5ae4969eee3427179b1b94ce3afa9b5 + +in upstream diff --git a/spago.dhall b/spago.dhall new file mode 100644 index 0000000..754ce08 --- /dev/null +++ b/spago.dhall @@ -0,0 +1,32 @@ +{- +Welcome to a Spago project! +You can edit this file as you like. + +Need help? See the following resources: +- Spago documentation: https://github.com/purescript/spago +- Dhall language tour: https://docs.dhall-lang.org/tutorials/Language-Tour.html + +When creating a new Spago project, you can use +`spago init --no-comments` or `spago init -C` +to generate this file without the comments in this block. +-} +{ name = "lenses" +, dependencies = + [ "arrays" + , "colors" + , "console" + , "effect" + , "either" + , "foldable-traversable" + , "integers" + , "maybe" + , "ordered-collections" + , "prelude" + , "profunctor" + , "profunctor-lenses" + , "tuples" + , "unfoldable" + ] +, packages = ./packages.dhall +, sources = [ "src/**/*.purs", "test/**/*.purs" ] +} diff --git a/src/SumType.purs b/src/SumType.purs index 9a06d0c..d5bd0ca 100644 --- a/src/SumType.purs +++ b/src/SumType.purs @@ -23,10 +23,9 @@ import Color (Color) import Color as Color import Data.Generic.Rep (class Generic) -import Data.Generic.Rep.Eq as GEq -import Data.Generic.Rep.Show as GShow import Data.Maybe (Maybe(..), maybe) import Data.Either (Either(..)) +import Data.Show.Generic (genericShow) import Data.Tuple (Tuple) import Data.Traversable (class Traversable) @@ -66,7 +65,7 @@ _solidFill = prism' constructor focuser constructor = Solid focuser fill = case fill of Solid color -> Just color - otherCases -> Nothing + _ -> Nothing -- In real life, you might abbreviate the above to this: @@ -256,21 +255,18 @@ _hslaSolid = prism' constructor focuser -- ... although Eq is only required for `only`. derive instance genericPercent :: Generic Percent _ -instance eqPercent :: Eq Percent where - eq = GEq.genericEq +derive instance eqPercent :: Eq Percent instance showPercent :: Show Percent where show (Percent f) = "(" <> show f <> "%)" derive instance genericPoint :: Generic Point _ -instance eqPoint :: Eq Point where - eq = GEq.genericEq +derive instance eqPoint :: Eq Point instance showPoint :: Show Point where show (Point x y) = "(" <> show x <> ", " <> show y <> ")" derive instance genericFill :: Generic Fill _ -instance eqFill :: Eq Fill where - eq = GEq.genericEq +derive instance eqFill :: Eq Fill instance showFill :: Show Fill where - show x = GShow.genericShow x + show x = genericShow x diff --git a/test/Main.purs b/test/Main.purs new file mode 100644 index 0000000..f91f98c --- /dev/null +++ b/test/Main.purs @@ -0,0 +1,11 @@ +module Test.Main where + +import Prelude + +import Effect (Effect) +import Effect.Class.Console (log) + +main :: Effect Unit +main = do + log "🍝" + log "You should add some tests." From 0c7d50648e72ad2a9e4c4c13b7d10511f540f2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20D=C3=BChr?= Date: Sun, 11 Dec 2022 15:26:29 +0100 Subject: [PATCH 2/2] Explicit SumType._solidFill example restored --- packages.dhall | 100 ----------------------------------------------- spago.dhall | 12 ------ src/SumType.purs | 2 +- 3 files changed, 1 insertion(+), 113 deletions(-) diff --git a/packages.dhall b/packages.dhall index 5ba2a63..7596fd2 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,103 +1,3 @@ -{- -Welcome to your new Dhall package-set! - -Below are instructions for how to edit this file for most use -cases, so that you don't need to know Dhall to use it. - -## Use Cases - -Most will want to do one or both of these options: -1. Override/Patch a package's dependency -2. Add a package not already in the default package set - -This file will continue to work whether you use one or both options. -Instructions for each option are explained below. - -### Overriding/Patching a package - -Purpose: -- Change a package's dependency to a newer/older release than the - default package set's release -- Use your own modified version of some dependency that may - include new API, changed API, removed API by - using your custom git repo of the library rather than - the package set's repo - -Syntax: -where `entityName` is one of the following: -- dependencies -- repo -- version -------------------------------- -let upstream = -- -in upstream - with packageName.entityName = "new value" -------------------------------- - -Example: -------------------------------- -let upstream = -- -in upstream - with halogen.version = "master" - with halogen.repo = "https://example.com/path/to/git/repo.git" - - with halogen-vdom.version = "v4.0.0" - with halogen-vdom.dependencies = [ "extra-dependency" ] # halogen-vdom.dependencies -------------------------------- - -### Additions - -Purpose: -- Add packages that aren't already included in the default package set - -Syntax: -where `` is: -- a tag (i.e. "v4.0.0") -- a branch (i.e. "master") -- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977") -------------------------------- -let upstream = -- -in upstream - with new-package-name = - { dependencies = - [ "dependency1" - , "dependency2" - ] - , repo = - "https://example.com/path/to/git/repo.git" - , version = - "" - } -------------------------------- - -Example: -------------------------------- -let upstream = -- -in upstream - with benchotron = - { dependencies = - [ "arrays" - , "exists" - , "profunctor" - , "strings" - , "quickcheck" - , "lcg" - , "transformers" - , "foldable-traversable" - , "exceptions" - , "node-fs" - , "node-buffer" - , "node-readline" - , "datetime" - , "now" - ] - , repo = - "https://github.com/hdgarrood/purescript-benchotron.git" - , version = - "v7.0.0" - } -------------------------------- --} let upstream = https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20221211/packages.dhall sha256:d115f153861ffe27fafa4afa1d337d4fc5ae4969eee3427179b1b94ce3afa9b5 diff --git a/spago.dhall b/spago.dhall index 754ce08..c06e600 100644 --- a/spago.dhall +++ b/spago.dhall @@ -1,15 +1,3 @@ -{- -Welcome to a Spago project! -You can edit this file as you like. - -Need help? See the following resources: -- Spago documentation: https://github.com/purescript/spago -- Dhall language tour: https://docs.dhall-lang.org/tutorials/Language-Tour.html - -When creating a new Spago project, you can use -`spago init --no-comments` or `spago init -C` -to generate this file without the comments in this block. --} { name = "lenses" , dependencies = [ "arrays" diff --git a/src/SumType.purs b/src/SumType.purs index d5bd0ca..53e5993 100644 --- a/src/SumType.purs +++ b/src/SumType.purs @@ -65,7 +65,7 @@ _solidFill = prism' constructor focuser constructor = Solid focuser fill = case fill of Solid color -> Just color - _ -> Nothing + otherCases -> Nothing -- In real life, you might abbreviate the above to this: