packages feed

calligraphy 0.1.5 → 0.1.6

raw patch · 19 files changed

+80/−83 lines, 19 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Prelude: (++) :: [a] -> [a] -> [a]
- Prelude: Ap :: f a -> Ap (f :: k -> Type) (a :: k)
- Prelude: [getAp] :: Ap (f :: k -> Type) (a :: k) -> f a
- Prelude: all :: Foldable t => (a -> Bool) -> t a -> Bool
- Prelude: and :: Foldable t => t Bool -> Bool
- Prelude: any :: Foldable t => (a -> Bool) -> t a -> Bool
- Prelude: asum :: (Foldable t, Alternative f) => t (f a) -> f a
- Prelude: class Foldable (t :: TYPE LiftedRep -> Type)
- Prelude: class Semigroup a => Monoid a
- Prelude: concat :: Foldable t => t [a] -> [a]
- Prelude: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- Prelude: elem :: (Foldable t, Eq a) => a -> t a -> Bool
- Prelude: filter :: (a -> Bool) -> [a] -> [a]
- Prelude: find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- Prelude: fold :: (Foldable t, Monoid m) => t m -> m
- Prelude: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- Prelude: foldMap' :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- Prelude: foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
- Prelude: foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
- Prelude: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
- Prelude: foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- Prelude: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
- Prelude: foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b
- Prelude: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
- Prelude: foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
- Prelude: forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- Prelude: for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- Prelude: infix 4 `notElem`
- Prelude: infixr 5 ++
- Prelude: isPrefixOf :: Eq a => [a] -> [a] -> Bool
- Prelude: last :: [a] -> a
- Prelude: length :: Foldable t => t a -> Int
- Prelude: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- Prelude: mappend :: Monoid a => a -> a -> a
- Prelude: maximum :: (Foldable t, Ord a) => t a -> a
- Prelude: maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- Prelude: mconcat :: Monoid a => [a] -> a
- Prelude: mempty :: Monoid a => a
- Prelude: minimum :: (Foldable t, Ord a) => t a -> a
- Prelude: minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- Prelude: msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
- Prelude: newtype Ap (f :: k -> Type) (a :: k)
- Prelude: notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- Prelude: null :: Foldable t => t a -> Bool
- Prelude: or :: Foldable t => t Bool -> Bool
- Prelude: ppr :: Outputable a => a -> SDoc
- Prelude: product :: (Foldable t, Num a) => t a -> a
- Prelude: replicate :: Int -> a -> [a]
- Prelude: sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
- Prelude: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- Prelude: showSDocUnsafe :: SDoc -> String
- Prelude: sum :: (Foldable t, Num a) => t a -> a
- Prelude: traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- Prelude: zip :: [a] -> [b] -> [(a, b)]
+ Calligraphy.Prelude: (++) :: [a] -> [a] -> [a]
+ Calligraphy.Prelude: Ap :: f a -> Ap (f :: k -> Type) (a :: k)
+ Calligraphy.Prelude: [getAp] :: Ap (f :: k -> Type) (a :: k) -> f a
+ Calligraphy.Prelude: all :: Foldable t => (a -> Bool) -> t a -> Bool
+ Calligraphy.Prelude: and :: Foldable t => t Bool -> Bool
+ Calligraphy.Prelude: any :: Foldable t => (a -> Bool) -> t a -> Bool
+ Calligraphy.Prelude: asum :: (Foldable t, Alternative f) => t (f a) -> f a
+ Calligraphy.Prelude: class Foldable (t :: TYPE LiftedRep -> Type)
+ Calligraphy.Prelude: class Semigroup a => Monoid a
+ Calligraphy.Prelude: concat :: Foldable t => t [a] -> [a]
+ Calligraphy.Prelude: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
+ Calligraphy.Prelude: elem :: (Foldable t, Eq a) => a -> t a -> Bool
+ Calligraphy.Prelude: filter :: (a -> Bool) -> [a] -> [a]
+ Calligraphy.Prelude: find :: Foldable t => (a -> Bool) -> t a -> Maybe a
+ Calligraphy.Prelude: fold :: (Foldable t, Monoid m) => t m -> m
+ Calligraphy.Prelude: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
+ Calligraphy.Prelude: foldMap' :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
+ Calligraphy.Prelude: foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
+ Calligraphy.Prelude: foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
+ Calligraphy.Prelude: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
+ Calligraphy.Prelude: foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
+ Calligraphy.Prelude: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
+ Calligraphy.Prelude: foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b
+ Calligraphy.Prelude: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
+ Calligraphy.Prelude: foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
+ Calligraphy.Prelude: forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
+ Calligraphy.Prelude: for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
+ Calligraphy.Prelude: infix 4 `notElem`
+ Calligraphy.Prelude: infixr 5 ++
+ Calligraphy.Prelude: isPrefixOf :: Eq a => [a] -> [a] -> Bool
+ Calligraphy.Prelude: last :: [a] -> a
+ Calligraphy.Prelude: length :: Foldable t => t a -> Int
+ Calligraphy.Prelude: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
+ Calligraphy.Prelude: mappend :: Monoid a => a -> a -> a
+ Calligraphy.Prelude: maximum :: (Foldable t, Ord a) => t a -> a
+ Calligraphy.Prelude: maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Calligraphy.Prelude: mconcat :: Monoid a => [a] -> a
+ Calligraphy.Prelude: mempty :: Monoid a => a
+ Calligraphy.Prelude: minimum :: (Foldable t, Ord a) => t a -> a
+ Calligraphy.Prelude: minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Calligraphy.Prelude: msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
+ Calligraphy.Prelude: newtype Ap (f :: k -> Type) (a :: k)
+ Calligraphy.Prelude: notElem :: (Foldable t, Eq a) => a -> t a -> Bool
+ Calligraphy.Prelude: null :: Foldable t => t a -> Bool
+ Calligraphy.Prelude: or :: Foldable t => t Bool -> Bool
+ Calligraphy.Prelude: ppr :: Outputable a => a -> SDoc
+ Calligraphy.Prelude: product :: (Foldable t, Num a) => t a -> a
+ Calligraphy.Prelude: replicate :: Int -> a -> [a]
+ Calligraphy.Prelude: sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
+ Calligraphy.Prelude: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
+ Calligraphy.Prelude: showSDocUnsafe :: SDoc -> String
+ Calligraphy.Prelude: sum :: (Foldable t, Num a) => t a -> a
+ Calligraphy.Prelude: traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
+ Calligraphy.Prelude: zip :: [a] -> [b] -> [(a, b)]

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog +## 0.1.6+### [Changed]+- Internal change; partially undid the Prelude structure implemented in [#22] and [#27], since it was causing issues (see [#32])+ ## 0.1.5 ### [Added] - [#19] [#20] GHC 9.6 support
calligraphy.cabal view
@@ -1,6 +1,6 @@ cabal-version:   2.4 name:            calligraphy-version:         0.1.5+version:         0.1.6 license:         BSD-3-Clause build-type:      Simple license-file:    LICENSE@@ -36,10 +36,6 @@     -Wincomplete-record-updates -Wredundant-constraints     -fhide-source-paths -Wpartial-fields -  mixins:-    base (Prelude as BasePrelude),-    base hiding (Prelude)- library   import:          common-options   hs-source-dirs:  src@@ -58,12 +54,12 @@     Calligraphy.Phases.Render.GraphViz     Calligraphy.Phases.Render.Mermaid     Calligraphy.Phases.Search+    Calligraphy.Prelude     Calligraphy.Util.Lens     Calligraphy.Util.LexTree     Calligraphy.Util.Optparse     Calligraphy.Util.Printer     Calligraphy.Util.Types-    Prelude    build-depends:     , array
src/Calligraphy.hs view
@@ -14,6 +14,7 @@ import Calligraphy.Phases.Render.GraphViz import Calligraphy.Phases.Render.Mermaid import Calligraphy.Phases.Search+import Calligraphy.Prelude import Calligraphy.Util.Printer import Calligraphy.Util.Types (ppCallGraph) import Data.IORef
src/Calligraphy/Compat/Debug.hs view
@@ -8,6 +8,7 @@   ) where +import Calligraphy.Prelude import Calligraphy.Util.Printer import qualified Data.Map as Map 
src/Calligraphy/Compat/GHC.hs view
@@ -44,6 +44,8 @@   ) where +import Calligraphy.Prelude+ #if MIN_VERSION_ghc(9,6,0) import Language.Haskell.Syntax.Module.Name (moduleNameString, ModuleName) #elif MIN_VERSION_ghc(9,0,0)
src/Calligraphy/Compat/Lib.hs view
@@ -19,10 +19,11 @@ where  import qualified Calligraphy.Compat.GHC as GHC+import Calligraphy.Prelude import Calligraphy.Util.Lens import Data.IORef-import qualified Data.Set as Set import qualified Data.Map as Map+import qualified Data.Set as Set  #if MIN_VERSION_ghc(9,4,0) 
src/Calligraphy/Phases/DependencyFilter.hs view
@@ -11,8 +11,10 @@   ) where -import Prelude hiding (Decl, DeclType, Node, filter)-+import Calligraphy.Prelude hiding (Decl, DeclType, Node, filter)+import Calligraphy.Util.Optparse (boolFlags)+import Calligraphy.Util.Printer+import Calligraphy.Util.Types import Control.Monad.State.Strict import Data.Bifunctor (bimap) import Data.EnumMap (EnumMap)@@ -29,10 +31,6 @@ import qualified Data.Tree as Tree import Data.Tuple (swap) import Options.Applicative--import Calligraphy.Util.Optparse (boolFlags)-import Calligraphy.Util.Printer-import Calligraphy.Util.Types  data DependencyFilterConfig = DependencyFilterConfig   { _depRoot :: Maybe (NonEmpty String),
src/Calligraphy/Phases/EdgeCleanup.hs view
@@ -3,14 +3,13 @@ -- | This modules collects some opinionated common-sense heuristics for removing edges that are probably redundant. module Calligraphy.Phases.EdgeCleanup (EdgeCleanupConfig, cleanupEdges, pEdgeCleanupConfig) where -import Prelude hiding (Node, Decl)+import Calligraphy.Prelude hiding (Decl, Node)+import Calligraphy.Util.Types (CallGraph (CallGraph), Decl (..), DeclType (..), Key, forT_, modForest) import Control.Monad.State.Strict import Data.Set (Set)+import qualified Data.Set as Set import Data.Tree import Options.Applicative-import qualified Data.Set as Set--import Calligraphy.Util.Types (CallGraph(CallGraph), Decl(..), Key, DeclType(..), forT_, modForest)  data EdgeCleanupConfig = EdgeCleanupConfig   { cleanDoubles :: Bool,
src/Calligraphy/Phases/NodeFilter.hs view
@@ -13,22 +13,21 @@ -- This is not actually a huge deal, because no other module actually cares about the node type, but it's something to watch out for. -- There's more design discussion on https://github.com/jonascarpay/calligraphy/pull/5 module Calligraphy.Phases.NodeFilter-  ( filterNodes-  , NodeFilterConfig (..)-  , pNodeFilterConfig-  ) where--import Prelude hiding (Decl)+  ( filterNodes,+    NodeFilterConfig (..),+    pNodeFilterConfig,+  )+where +import Calligraphy.Prelude hiding (Decl)+import Calligraphy.Util.Types import Control.Monad.State import Data.EnumMap (EnumMap)+import qualified Data.EnumMap as EnumMap import Data.Maybe (catMaybes) import Data.Tree (Tree) import qualified Data.Tree as Tree import Options.Applicative-import qualified Data.EnumMap as EnumMap--import Calligraphy.Util.Types  data Mode = Show | Collapse | Hide   deriving (Eq, Show)
src/Calligraphy/Phases/Parse.hs view
@@ -12,8 +12,14 @@   ) where -import Prelude hiding (Decl, DeclType)-+import qualified Calligraphy.Compat.GHC as GHC+import Calligraphy.Compat.Lib (isDerivingNode, isInlineNode, isInstanceNode, isMinimalNode, isTypeSignatureNode, mergeSpans, sourceInfo)+import qualified Calligraphy.Compat.Lib as GHC+import Calligraphy.Prelude hiding (Decl, DeclType)+import Calligraphy.Util.LexTree (LexTree, TreeError (..), foldLexTree)+import qualified Calligraphy.Util.LexTree as LT+import Calligraphy.Util.Printer+import Calligraphy.Util.Types (CallGraph (..), Decl (..), DeclType (..), GHCKey (..), Key (..), Loc (..), Module (..), forT_, forestT, over, rekeyCalls) import Control.Monad.Except import Control.Monad.State import Data.Array (Array)@@ -32,14 +38,6 @@ import qualified Data.Set as Set import Data.Tree (Forest) import qualified Data.Tree as Tree--import qualified Calligraphy.Compat.GHC as GHC-import Calligraphy.Compat.Lib (isDerivingNode, isInlineNode, isInstanceNode, isMinimalNode, isTypeSignatureNode, mergeSpans, sourceInfo)-import qualified Calligraphy.Compat.Lib as GHC-import Calligraphy.Util.LexTree (LexTree, TreeError (..), foldLexTree)-import qualified Calligraphy.Util.LexTree as LT-import Calligraphy.Util.Printer-import Calligraphy.Util.Types (GHCKey(..), Loc(..), DeclType(..), Decl(..), Key(..), CallGraph(..), Module(..), rekeyCalls, forestT, over, forT_)  -- | A declaration extracted from the source code. --
src/Calligraphy/Phases/Render/Common.hs view
@@ -16,7 +16,6 @@   ) where -import Prelude hiding (Decl, DeclType) import Calligraphy.Util.Printer (Prints, strLn) import Calligraphy.Util.Types (CallGraph (..), Decl (..), DeclType, GHCKey (unGHCKey), Key (..), Loc (..), Module (..)) import Control.Applicative ((<|>))
src/Calligraphy/Phases/Render/GraphViz.hs view
@@ -9,9 +9,8 @@   ) where -import Prelude hiding (DeclType)- import Calligraphy.Phases.Render.Common+import Calligraphy.Prelude hiding (DeclType) import Calligraphy.Util.Printer import Calligraphy.Util.Types import Data.List (intercalate)
src/Calligraphy/Phases/Render/Mermaid.hs view
@@ -5,8 +5,8 @@   ) where -import Prelude hiding (Node, Decl, DeclType) import Calligraphy.Phases.Render.Common+import Calligraphy.Prelude hiding (Decl, DeclType, Node) import Calligraphy.Util.Printer import Calligraphy.Util.Types import Control.Monad.State (State, execState, modify)
src/Calligraphy/Phases/Search.hs view
@@ -9,6 +9,7 @@  import qualified Calligraphy.Compat.GHC as GHC import Calligraphy.Compat.Lib+import Calligraphy.Prelude import Control.Applicative import Data.List.NonEmpty (NonEmpty (..), nonEmpty, toList) import Options.Applicative hiding (str)
+ src/Calligraphy/Prelude.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE CPP #-}+module Calligraphy.Prelude+  ( module Control.Monad+  , module Data.Either+  , module Data.Foldable+  , module Data.List+  , module Data.Monoid+#if MIN_VERSION_ghc(9,0,0)+  , module GHC.Iface.Ext.Binary+  , module GHC.Iface.Ext.Types+  , module GHC.Types.Name.Cache+  , module GHC.Types.SrcLoc+  , module GHC.Utils.Outputable+#else+  , module HieBin+  , module HieTypes+  , module NameCache+  , module SrcLoc+#endif+  ) where++import Control.Monad+import Data.Either+import Data.Foldable hiding (toList)+import Data.List (last, (++), replicate, zip, filter, isPrefixOf)+import Data.Monoid (Monoid, mempty, mconcat, mappend, Ap(..))+#if MIN_VERSION_ghc(9,0,0)+import GHC.Iface.Ext.Binary+import GHC.Iface.Ext.Types+import GHC.Types.Name.Cache+import GHC.Types.SrcLoc+import GHC.Utils.Outputable (ppr, showSDocUnsafe)+#else+import HieBin+import HieTypes+import NameCache+import SrcLoc+#endif
src/Calligraphy/Util/Printer.hs view
@@ -13,6 +13,7 @@   ) where +import Calligraphy.Prelude import Control.Monad.RWS import Data.Text (Text) import qualified Data.Text.Lazy as TL
src/Calligraphy/Util/Types.hs view
@@ -24,7 +24,7 @@   ) where -import Prelude hiding (Decl, DeclType, Node)+import Calligraphy.Prelude hiding (Decl, DeclType, Node) import Calligraphy.Util.Lens import Calligraphy.Util.Printer import Data.Bitraversable (bitraverse)
− src/Prelude.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE CPP #-}-module Prelude -  ( module P-  , module Control.Monad-  , module Data.Either-  , module Data.Foldable-  , module Data.List-  , module Data.Monoid-#if MIN_VERSION_ghc(9,0,0)-  , module GHC.Iface.Ext.Binary-  , module GHC.Iface.Ext.Types-  , module GHC.Types.Name.Cache-  , module GHC.Types.SrcLoc-  , module GHC.Utils.Outputable -#else-  , module HieBin-  , module HieTypes-  , module NameCache-  , module SrcLoc-#endif-  ) where--import Control.Monad-import Data.Either-import Data.Foldable hiding (toList)-import Data.List (last, (++), replicate, zip, filter, isPrefixOf)-import Data.Monoid (Monoid, mempty, mconcat, mappend, Ap(..))-import qualified BasePrelude as P -import BasePrelude-#if MIN_VERSION_ghc(9,0,0)-import GHC.Iface.Ext.Binary-import GHC.Iface.Ext.Types-import GHC.Types.Name.Cache-import GHC.Types.SrcLoc-import GHC.Utils.Outputable (ppr, showSDocUnsafe)-#else-import HieBin-import HieTypes-import NameCache-import SrcLoc-#endif
test/Test/LexTree.hs view
@@ -1,10 +1,11 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wno-orphans #-}  module Test.LexTree where +import Calligraphy.Prelude import Calligraphy.Util.LexTree import qualified Data.Foldable as Foldable import Data.Maybe (fromMaybe, isJust)