Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: feuerbach/traverse-with-class
base: c916355383
...
head fork: feuerbach/traverse-with-class
compare: 6be85d3d4f
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
View
20 Data/Generics/Traversable/Instances.hs
@@ -8,15 +8,15 @@ import Data.Generics.Traversable.TH
import Control.Applicative
import Data.Ratio
-instance c () => GTraversable c ()
-instance c Bool => GTraversable c Bool
-instance c Int => GTraversable c Int
-instance c Integer => GTraversable c Integer
-instance c Float => GTraversable c Float
-instance c Double => GTraversable c Double
-instance c (Ratio n) => GTraversable c (Ratio n)
-instance c Char => GTraversable c Char
-instance c Ordering => GTraversable c Ordering
+instance GTraversable c ()
+instance GTraversable c Bool
+instance GTraversable c Int
+instance GTraversable c Integer
+instance GTraversable c Float
+instance GTraversable c Double
+instance GTraversable c (Ratio n)
+instance GTraversable c Char
+instance GTraversable c Ordering
deriveGTraversable ''Maybe
deriveGTraversable ''Either
@@ -24,7 +24,7 @@ deriveGTraversable ''(,)
deriveGTraversable ''(,,)
-- Uniform instance for lists
-instance (GTraversable c a, c a, c [a]) => GTraversable c [a] where
+instance c a => GTraversable c [a] where
gtraverse f = go where
go [] = pure []
go (x:xs) = (:) <$> f x <*> go xs
View
7 Data/Generics/Traversable/TH.hs
@@ -86,12 +86,11 @@ deriveGTraversable name = do
funD 'gtraverse [ clause [] (normalB $ gtraverseExpr typeName) [] ]
]
- context = sequence $ gtraversableContext ++ userContext
+ context = sequence userContext
- types = filter (/= appliedType) $ nub [ t | (_,_,ts) <- constructors, t <- ts ]
+ types = nub [ t | (_,_,ts) <- constructors, t <- ts ]
- userContext = [ classP ctx [pure t] | t <- appliedType : types ]
- gtraversableContext = [ classP ''GTraversable [varT ctx, pure t] | t <- types ]
+ userContext = [ classP ctx [pure t] | t <- types ]
sequence [inst]

No commit comments for this range

Something went wrong with that request. Please try again.