mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Merge pull request #385 from github/data-dot-ordered-map
Move OrderedMap into Data.
This commit is contained in:
commit
768ca30a7b
@ -20,7 +20,7 @@ library
|
||||
, Interpreter
|
||||
, Line
|
||||
, Row
|
||||
, OrderedMap
|
||||
, Data.OrderedMap
|
||||
, Patch
|
||||
, PatchOutput
|
||||
, SES
|
||||
|
@ -1,10 +1,10 @@
|
||||
module OrderedMap (
|
||||
module Data.OrderedMap (
|
||||
OrderedMap
|
||||
, fromList
|
||||
, toList
|
||||
, keys
|
||||
, (!)
|
||||
, OrderedMap.lookup
|
||||
, Data.OrderedMap.lookup
|
||||
, size
|
||||
, empty
|
||||
, union
|
||||
@ -31,7 +31,7 @@ keys (OrderedMap pairs) = fst <$> pairs
|
||||
infixl 9 !
|
||||
|
||||
(!) :: Eq key => OrderedMap key value -> key -> value
|
||||
map ! key = Maybe.fromMaybe (error "no value found for key") $ OrderedMap.lookup key map
|
||||
map ! key = Maybe.fromMaybe (error "no value found for key") $ Data.OrderedMap.lookup key map
|
||||
|
||||
lookup :: Eq key => key -> OrderedMap key value -> Maybe value
|
||||
lookup key = Prelude.lookup key . toList
|
@ -10,8 +10,8 @@ import Syntax
|
||||
import Term
|
||||
import Control.Monad.Free
|
||||
import Control.Comonad.Cofree hiding (unwrap)
|
||||
import qualified OrderedMap as Map
|
||||
import OrderedMap ((!))
|
||||
import qualified Data.OrderedMap as Map
|
||||
import Data.OrderedMap ((!))
|
||||
import qualified Data.List as List
|
||||
import Data.List ((\\))
|
||||
import Data.Maybe
|
||||
|
@ -1,7 +1,7 @@
|
||||
module Operation where
|
||||
|
||||
import Diff
|
||||
import OrderedMap
|
||||
import Data.OrderedMap
|
||||
import qualified Data.Text as T
|
||||
import Term
|
||||
|
||||
|
@ -4,7 +4,7 @@ import Diff
|
||||
import Syntax
|
||||
import Term
|
||||
import Control.Comonad.Cofree
|
||||
import qualified OrderedMap as Map
|
||||
import qualified Data.OrderedMap as Map
|
||||
import qualified Data.Set as Set
|
||||
import Source
|
||||
import Data.Text as Text
|
||||
|
@ -21,7 +21,7 @@ import Data.Either
|
||||
import Data.Foldable
|
||||
import Data.Functor.Identity
|
||||
import Data.Monoid
|
||||
import qualified OrderedMap as Map
|
||||
import qualified Data.OrderedMap as Map
|
||||
import qualified Data.Set as Set
|
||||
import Source hiding ((++))
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Syntax where
|
||||
|
||||
import OrderedMap
|
||||
import Data.OrderedMap
|
||||
import qualified Data.Text as T
|
||||
|
||||
-- | A node in an abstract syntax tree.
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Term where
|
||||
|
||||
import OrderedMap hiding (size)
|
||||
import Data.OrderedMap hiding (size)
|
||||
import Data.Maybe
|
||||
import Control.Comonad.Cofree
|
||||
import Syntax
|
||||
|
@ -10,7 +10,7 @@ import Control.Arrow
|
||||
import Control.Monad.Free
|
||||
import Control.Comonad.Cofree
|
||||
import Data.List hiding (foldl)
|
||||
import qualified OrderedMap as Map
|
||||
import qualified Data.OrderedMap as Map
|
||||
import Rainbow
|
||||
|
||||
unified :: Diff a Info -> Source Char -> Source Char -> IO ByteString
|
||||
@ -30,7 +30,7 @@ unified diff before after = do
|
||||
afterChunk = maybe [] (change "+" . unifiedTerm after) $ Patch.after patch
|
||||
|
||||
unifiedTerm :: Source Char -> Term a Info -> [Chunk String]
|
||||
|
||||
|
||||
unifiedTerm source term = fst $ cata (annotationAndSyntaxToChunks source) term
|
||||
|
||||
unifiedRange :: Range -> [([Chunk String], Maybe Range)] -> Source Char -> [Chunk String]
|
||||
|
@ -5,7 +5,7 @@ import Syntax
|
||||
import Term
|
||||
import Control.Comonad.Cofree
|
||||
import Control.Monad
|
||||
import qualified OrderedMap as Map
|
||||
import qualified Data.OrderedMap as Map
|
||||
import qualified Data.List as List
|
||||
import qualified Data.Set as Set
|
||||
import GHC.Generics
|
||||
|
@ -1,6 +1,6 @@
|
||||
module OrderedMapSpec where
|
||||
|
||||
import OrderedMap as Map
|
||||
import qualified Data.OrderedMap as Map
|
||||
import Test.Hspec
|
||||
|
||||
spec :: Spec
|
||||
|
Loading…
Reference in New Issue
Block a user