Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
d5c278cf
Commit
d5c278cf
authored
Jan 17, 2008
by
Duncan Coutts
Browse files
Add Utils module, tidy imports
parent
1517ab38
Changes
3
Hide whitespace changes
Inline
Side-by-side
cabal-install/Hackage/ParseUtils.hs
View file @
d5c278cf
...
...
@@ -4,17 +4,13 @@ import Distribution.Compat.ReadP (ReadP, readP_to_S, pfail, get, look, choice, (
import
Distribution.Package
(
PackageIdentifier
(
..
),
parsePackageId
)
import
Distribution.ParseUtils
(
Field
(
..
),
FieldDescr
(
..
),
ParseResult
(
..
),
PError
,
field
,
liftField
,
readFields
,
showDependency
,
parseDependency
,
field
,
liftField
,
readFields
,
parseDependency
,
warning
,
lineNo
,
locatedErrorMsg
)
import
Distribution.Version
(
Version
(
..
),
Dependency
(
..
),
VersionRange
(
..
))
import
Control.Exception
import
Control.Monad
(
foldM
,
liftM
,
guard
)
import
Control.Monad
(
foldM
,
liftM
)
import
Data.Char
(
isSpace
,
toLower
)
import
Data.List
(
intersperse
)
import
Data.Maybe
(
listToMaybe
)
import
System.IO.Error
(
isDoesNotExistError
)
import
Text.PrettyPrint.HughesPJ
(
Doc
,
render
,
vcat
,
text
,
(
<>
),
(
<+>
))
...
...
cabal-install/Hackage/Utils.hs
0 → 100644
View file @
d5c278cf
module
Hackage.Utils
where
import
Distribution.ParseUtils
(
showDependency
)
import
Distribution.Version
(
Dependency
(
..
))
import
Control.Exception
import
Control.Monad
(
guard
)
import
qualified
Data.Char
as
Char
(
toLower
)
import
Data.List
(
intersperse
)
import
System.IO.Error
(
isDoesNotExistError
)
readFileIfExists
::
FilePath
->
IO
(
Maybe
String
)
readFileIfExists
path
=
catchJust
fileNotFoundExceptions
(
fmap
Just
(
readFile
path
))
(
\
_
->
return
Nothing
)
fileNotFoundExceptions
::
Exception
->
Maybe
IOError
fileNotFoundExceptions
e
=
ioErrors
e
>>=
\
ioe
->
guard
(
isDoesNotExistError
ioe
)
>>
return
ioe
showDependencies
::
[
Dependency
]
->
String
showDependencies
=
concat
.
intersperse
", "
.
map
(
show
.
showDependency
)
equating
::
Eq
a
=>
(
b
->
a
)
->
b
->
b
->
Bool
equating
p
x
y
=
p
x
==
p
y
comparing
::
Ord
a
=>
(
b
->
a
)
->
b
->
b
->
Ordering
comparing
p
x
y
=
p
x
`
compare
`
p
y
lowercase
::
String
->
String
lowercase
=
map
Char
.
toLower
cabal-install/cabal-install.cabal
View file @
d5c278cf
...
...
@@ -42,6 +42,7 @@ Executable cabal
Hackage.Info
Hackage.Install
Hackage.List
Hackage.ParseUtils
Hackage.Setup
Hackage.Tar
Hackage.Types
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment