Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
Move funcitons to local where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
skilly-lily committed Sep 25, 2020
1 parent cb1acbd commit d6594c4
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Strategy/Erlang/Rebar3Tree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ unaliasDeps :: M.Map Text Text -> [Rebar3Dep] -> [Rebar3Dep]
unaliasDeps aliasMap = map unalias
where
unalias :: Rebar3Dep -> Rebar3Dep
unalias dep = changeName (lookupName (depName dep) aliasMap) dep
unalias dep = changeName dep . lookupName aliasMap $ depName dep
lookupName :: M.Map Text Text -> Text -> Text
lookupName map' name = M.findWithDefault name name map'
changeName :: Rebar3Dep -> Text -> Rebar3Dep
changeName dep name = dep { depName = name }

mkProjectClosure :: Path Abs Dir -> [Rebar3Dep] -> ProjectClosureBody
mkProjectClosure dir deps = ProjectClosureBody
Expand All @@ -101,19 +105,13 @@ buildGraph deps = unfold deps subDeps toDependency
, dependencyTags = M.empty
}

lookupName :: Text -> M.Map Text Text -> Text
lookupName name = M.findWithDefault name name

data Rebar3Dep = Rebar3Dep
{ depName :: Text
, depVersion :: Text
, depLocation :: Text
, subDeps :: [Rebar3Dep]
} deriving (Eq, Ord, Show)

changeName :: Text -> Rebar3Dep -> Rebar3Dep
changeName name dep = dep { depName = name }

type Parser = Parsec Void Text

rebar3TreeParser :: Parser [Rebar3Dep]
Expand Down

0 comments on commit d6594c4

Please sign in to comment.