Skip to content

Commit

Permalink
Compiler/0.12 (#17)
Browse files Browse the repository at this point in the history
Updates for 0.12 (#15) and (#16)
  • Loading branch information
ethul authored May 27, 2018
1 parent 9025683 commit f7f76c9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 24 deletions.
15 changes: 7 additions & 8 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
"url": "git://github.com/ethul/purescript-freeap.git"
},
"dependencies": {
"purescript-exists": "^3.0.0",
"purescript-const": "^3.0.0"
"purescript-exists": "^4.0.0",
"purescript-const": "^4.0.0"
},
"devDependencies": {
"purescript-either": "^3.0.0",
"purescript-integers": "^3.0.0",
"purescript-generics": "^4.0.0",
"purescript-console": "^3.0.0",
"purescript-exceptions": "^3.0.0",
"purescript-quickcheck-laws": "^3.0.1"
"purescript-either": "^4.0.0",
"purescript-integers": "^4.0.0",
"purescript-console": "^4.1.0",
"purescript-exceptions": "^4.0.0",
"purescript-quickcheck-laws": "paulyoung/purescript-quickcheck-laws#compiler/0.12"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"build": "pulp build -- --censor-lib --strict"
},
"devDependencies": {
"pulp": "^11.0.0",
"purescript-psa": "^0.5.1",
"rimraf": "^2.6.1"
"pulp": "^12.2.0",
"purescript-psa": "^0.6.0",
"rimraf": "^2.6.2"
}
}
4 changes: 2 additions & 2 deletions src/Control/Applicative/Free.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ module Control.Applicative.Free
) where

import Prelude

import Data.Const (Const(..))
import Data.Either (Either(..))
import Data.List (List(..))
import Data.List.NonEmpty as NEL
import Data.Monoid (class Monoid)
import Data.Newtype (unwrap)
import Data.NonEmpty ((:|))
import Data.Tuple (Tuple(..))
Expand Down Expand Up @@ -110,7 +110,7 @@ goLeft fStack valStack nat func count = case func of
-- | Run a free applicative functor using the applicative instance for
-- | the type constructor `f`.
retractFreeAp :: forall f a. Applicative f => FreeAp f a -> f a
retractFreeAp = foldFreeAp id
retractFreeAp = foldFreeAp identity

-- | Natural transformation from `FreeAp f a` to `FreeAp g a` given a
-- | natural transformation from `f` to `g`.
Expand Down
11 changes: 6 additions & 5 deletions test/Test/Control/Applicative/Free.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import Control.Applicative.Free (FreeAp, liftFreeAp, analyzeFreeAp, retractFreeA
import Control.Applicative.Free.Gen as GenF
import Data.Either (Either(..))
import Data.Tuple (Tuple)
import Effect (Effect)
import Test.QuickCheck (class Arbitrary, class Coarbitrary, arbitrary)
import Test.QuickCheck.Gen (Gen)
import Test.QuickCheck.Laws (QC, A, checkLaws)
import Test.QuickCheck.Laws (A, checkLaws)
import Test.QuickCheck.Laws.Control as Control
import Test.QuickCheck.Laws.Data as Data
import Type.Proxy (Proxy(..), Proxy2(..))
Expand Down Expand Up @@ -42,7 +43,7 @@ buildExpected 0 _ acc = acc
buildExpected n x acc = buildExpected (n - 1) x (acc <> x)

checkAnalyze :: Either String String
checkAnalyze =
checkAnalyze =
if result == expected
then Right result
else Left (result <> " is not " <> expected)
Expand All @@ -55,7 +56,7 @@ checkAnalyze =


checkStack :: Either String String
checkStack =
checkStack =
if result == expected
then Right "safe for 100000 node"
else Left (result <> " is not " <> expected)
Expand All @@ -70,7 +71,7 @@ checkStack =
newtype ArbFreeAp a = ArbFreeAp (FreeAp (Tuple (Array String)) a)

instance arbitraryArbFreeAp :: (Coarbitrary a, Arbitrary a) => Arbitrary (ArbFreeAp a) where
arbitrary = ArbFreeAp <$>
arbitrary = ArbFreeAp <$>
GenF.genFree
arbitrary
(arbitrary :: Gen a)
Expand All @@ -83,7 +84,7 @@ derive newtype instance functorArbFreeAp :: Functor ArbFreeAp
derive newtype instance applyArbFreeAp :: Apply ArbFreeAp
derive newtype instance applicativeArbFreeAp :: Applicative ArbFreeAp

check eff. QC eff Unit
check Effect Unit
check = checkLaws "FreeAp" do
Data.checkEq prxFree
Data.checkFunctor prx2Free
Expand Down
2 changes: 1 addition & 1 deletion test/Test/Control/Applicative/Free/Validation.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Test.Control.Applicative.Free.Validation
import Prelude (class Show, show, (<<<), (==), (<$>), (<*>), (<>))

import Control.Applicative.Free (FreeAp, foldFreeAp, liftFreeAp)
import Control.Monad.Eff.Exception.Unsafe (unsafeThrow)
import Effect.Exception.Unsafe (unsafeThrow)

import Data.Either (Either(..))
import Data.Int (fromString)
Expand Down
8 changes: 3 additions & 5 deletions test/Test/Main.purs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
module Test.Main where

import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log, logShow)
import Control.Monad.Eff.Exception (EXCEPTION)
import Control.Monad.Eff.Random (RANDOM)
import Effect (Effect)
import Effect.Console (log, logShow)
import Test.Control.Applicative.Free as FreeTest
import Test.Control.Applicative.Free.Validation as Validation

main :: Eff (console CONSOLE , random RANDOM , exception EXCEPTION) Unit
main :: Effect Unit
main = do
log "\nvalid case:"
logShow (Validation.runForm "Joe" "Smith" "28")
Expand Down

0 comments on commit f7f76c9

Please sign in to comment.