Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
dist: trusty
sudo: required
node_js: 6
node_js: stable
env:
- PATH=$HOME/purescript:$PATH
install:
Expand Down
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"package.json"
],
"dependencies": {
"purescript-foldable-traversable": "^2.2.0",
"purescript-prelude": "^2.4.0"
"purescript-foldable-traversable": "^3.0.0",
"purescript-prelude": "^3.0.0"
},
"devDependencies": {
"purescript-assert": "^2.0.0",
"purescript-console": "^2.0.0"
"purescript-assert": "^3.0.0",
"purescript-console": "^3.0.0"
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build --censor-lib --strict",
"build": "pulp build -- --censor-lib --strict",
"test": "pulp test"
},
"devDependencies": {
"pulp": "^9.0.1",
"purescript-psa": "^0.3.9",
"rimraf": "^2.5.0"
"pulp": "^10.0.4",
"purescript-psa": "^0.5.0-rc.1",
"rimraf": "^2.6.1"
}
}
10 changes: 6 additions & 4 deletions src/Data/NonEmpty.purs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ foldl1 :: forall f a. Foldable f => (a -> a -> a) -> NonEmpty f a -> a
foldl1 f (a :| fa) = foldl f a fa

-- | Fold a non-empty structure, collecting results in a `Semigroup`.
foldMap1 :: forall f a s. (Semigroup s, Foldable f) => (a -> s) -> NonEmpty f a -> s
foldMap1 :: forall f a s. Semigroup s => Foldable f => (a -> s) -> NonEmpty f a -> s
foldMap1 f (a :| fa) = foldl (\s a1 -> s <> f a1) (f a) fa

-- | Fold a non-empty structure.
fold1 :: forall f s. (Semigroup s, Foldable f) => NonEmpty f s -> s
fold1 :: forall f s. Semigroup s => Foldable f => NonEmpty f s -> s
fold1 = foldMap1 id

fromNonEmpty :: forall f a r. (a -> f a -> r) -> NonEmpty f a -> r
Expand All @@ -70,12 +70,14 @@ tail (_ :| xs) = xs
instance showNonEmpty :: (Show a, Show (f a)) => Show (NonEmpty f a) where
show (a :| fa) = "(NonEmpty " <> show a <> " " <> show fa <> ")"

derive instance eqNonEmpty :: (Eq a, Eq (f a)) => Eq (NonEmpty f a)
instance eqNonEmpty :: (Eq1 f, Eq a) => Eq (NonEmpty f a) where
eq = eq1

instance eq1NonEmpty :: Eq1 f => Eq1 (NonEmpty f) where
eq1 (NonEmpty a fa) (NonEmpty b fb) = a == b && fa `eq1` fb

derive instance ordNonEmpty :: (Ord a, Ord (f a)) => Ord (NonEmpty f a)
instance ordNonEmpty :: (Ord1 f, Ord a) => Ord (NonEmpty f a) where
compare = compare1

instance ord1NonEmpty :: Ord1 f => Ord1 (NonEmpty f) where
compare1 (NonEmpty a fa) (NonEmpty b fb) =
Expand Down