Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Open.Base to GTraversable

  • Loading branch information...
commit d9931a0da3a078eafae75abaa1ac4af6b72bc7d2 1 parent 3903cad
@feuerbach feuerbach authored
Showing with 18 additions and 23 deletions.
  1. +18 −23 src/Language/Haskell/Modules/Open/Base.hs
View
41 src/Language/Haskell/Modules/Open/Base.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE RankNTypes, FlexibleInstances, FlexibleContexts, UndecidableInstances, DefaultSignatures, OverlappingInstances, TemplateHaskell #-}
+{-# LANGUAGE ImplicitParams #-}
module Language.Haskell.Modules.Open.Base where
import qualified Language.Haskell.Modules.GlobalSymbolTable as Global
@@ -6,11 +7,11 @@ import qualified Language.Haskell.Modules.LocalSymbolTable as Local
import Language.Haskell.Modules.SyntaxUtils
import Language.Haskell.Exts.Annotated
import Control.Applicative
-import Data.Generics.SYB.WithClass.Basics
-import Control.Arrow
import Data.List
import Data.Lens.Common
import Data.Lens.Template
+import Data.Generics.Traversable
+import Data.Proxy
data NameContext = Binding | Reference | Other
@@ -22,29 +23,23 @@ data Scope = Scope
makeLens ''Scope
-defaultRfoldl
- :: Data ResolvableD a
- => (forall b c. Data ResolvableD b => w (b -> c) -> b -> Scope -> w c)
- -> (forall g. g -> w g)
- -> a -> Scope -> w a
-defaultRfoldl f z = unScopeT .
- gfoldl
- (undefined :: Proxy ResolvableD)
- (\(ScopeT a) x -> ScopeT $ f <$> a >>= \k -> k x)
- (ScopeT . pure . z)
-
-newtype ResolvableD a = ResolvableD
- { rfoldl
- :: forall w .
- (forall b c. Data ResolvableD b => w (b -> c) -> b -> Scope -> w c)
- -> (forall g. g -> w g)
- -> a -> Scope -> w a
- }
+defaultRtraverse
+ :: (GTraversable Resolvable a, Applicative f)
+ => (forall d . Resolvable d => d -> Scope -> f d)
+ -> a -> Scope -> f a
+defaultRtraverse f a sc =
+ let ?c = Proxy :: Proxy Resolvable
+ in gtraverse (\a -> f a sc) a
+
+class Resolvable a where
+ rtraverse
+ :: Applicative f
+ => (forall d . Resolvable d => d -> Scope -> f d)
+ -> a -> Scope -> f a
-newtype ScopeT w a = ScopeT { unScopeT :: Scope -> w a }
-instance Data ResolvableD a => Sat (ResolvableD a) where
- dict = ResolvableD defaultRfoldl
+instance GTraversable Resolvable a => Resolvable a where
+ rtraverse = defaultRtraverse
intro :: (SrcInfo l, GetBound a l) => a -> Scope -> Scope
intro node =
Please sign in to comment.
Something went wrong with that request. Please try again.