Skip to content

Remove Ref instance #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2014
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
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

instance foldableMaybe :: Foldable Maybe

instance foldableRef :: Foldable Ref

instance foldableTuple :: Foldable (Tuple a)


Expand Down Expand Up @@ -94,8 +92,6 @@

instance traversableMaybe :: Traversable Maybe

instance traversableRef :: Traversable Ref

instance traversableTuple :: Traversable (Tuple a)


Expand Down
9 changes: 0 additions & 9 deletions src/Data/Foldable.purs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module Data.Foldable where

import Prelude
import Control.Apply
import Data.Either
import Data.Eq
import Data.Maybe
import Data.Monoid
import Data.Monoid.First
Expand Down Expand Up @@ -41,13 +39,6 @@ instance foldableMaybe :: Foldable Maybe where
foldMap f Nothing = mempty
foldMap f (Just x) = f x

instance foldableRef :: Foldable Ref where
foldr f z (Ref x) = x `f` z

foldl f z (Ref x) = z `f` x

foldMap f (Ref x) = f x

instance foldableTuple :: Foldable (Tuple a) where
foldr f z (Tuple _ x) = x `f` z

Expand Down
11 changes: 2 additions & 9 deletions src/Data/Traversable.purs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Data.Traversable
module Data.Traversable
( Traversable
, traverse
, sequence
Expand All @@ -8,10 +8,8 @@ module Data.Traversable
, mapAccumR
) where

import Prelude
import Data.Array (zipWith)
import Data.Either
import Data.Eq
import Data.Foldable
import Data.Maybe
import Data.Tuple
Expand All @@ -34,11 +32,6 @@ instance traversableEither :: Traversable (Either a) where
sequence (Left x) = pure (Left x)
sequence (Right x) = Right <$> x

instance traversableRef :: Traversable Ref where
traverse f (Ref x) = Ref <$> f x

sequence (Ref x) = Ref <$> x

instance traversableMaybe :: Traversable Maybe where
traverse _ Nothing = pure Nothing
traverse f (Just x) = Just <$> f x
Expand Down Expand Up @@ -85,7 +78,7 @@ stateR (StateR k) = k
instance functorStateR :: Functor (StateR s) where
(<$>) f k = StateR $ \s -> case stateR k s of
Tuple s1 a -> Tuple s1 (f a)

instance applyStateR :: Apply (StateR s) where
(<*>) f x = StateR $ \s -> case stateR x s of
Tuple s1 x' -> case stateR f s1 of
Expand Down