Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
cf27ce2f
Commit
cf27ce2f
authored
26 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-08-14 12:59:24 by sof]
Generate better IOErrors
parent
b79d9b09
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ghc/lib/std/CPUTime.lhs
+2
-2
2 additions, 2 deletions
ghc/lib/std/CPUTime.lhs
ghc/lib/std/Directory.lhs
+4
-4
4 additions, 4 deletions
ghc/lib/std/Directory.lhs
ghc/lib/std/System.lhs
+5
-5
5 additions, 5 deletions
ghc/lib/std/System.lhs
with
11 additions
and
11 deletions
ghc/lib/std/CPUTime.lhs
+
2
−
2
View file @
cf27ce2f
...
...
@@ -43,8 +43,8 @@ getCPUTime =
fromIntegral (I# (indexIntArray# frozen# 2#)) * 1000000000 +
fromIntegral (I# (indexIntArray# frozen# 3#))) * 1000)
else
fail (IOError Nothing UnsupportedOperation
"
getCPUTime:
can't get CPU time")
fail (IOError Nothing UnsupportedOperation
"getCPUTime"
"can't get CPU time")
cpuTimePrecision :: Integer
cpuTimePrecision = round ((1000000000000::Integer) %
...
...
This diff is collapsed.
Click to expand it.
ghc/lib/std/Directory.lhs
+
4
−
4
View file @
cf27ce2f
...
...
@@ -44,7 +44,7 @@ import PrelIOBase
import PrelST
import PrelArr
import PrelPack ( unpackNBytesST )
import Prel
Foreign
( Word(..) )
import Prel
CCall
( Word(..) )
import PrelAddr
import Time ( ClockTime(..) )
...
...
@@ -259,7 +259,7 @@ renameDirectory opath npath = do
if rc == 0 then
return ()
else
constructErrorAndFailWithInfo "renameDirectory"
opath
constructErrorAndFailWithInfo "renameDirectory"
("old: " ++ opath ++ ",new: " ++ npath)
\end{code}
@renameFile old@ {\em new} changes the name of an existing file system
...
...
@@ -473,7 +473,7 @@ setPermissions name (Permissions r w e s) = do
rc <- _ccall_ chmod name mode
if rc == 0
then return ()
else fail (IOError Nothing SystemError "
Directory.setP
ermissions")
else fail (IOError Nothing SystemError "
setPermissions" "insufficient p
ermissions")
\end{code}
...
...
@@ -489,7 +489,7 @@ getFileStatus name = do
rc <- _casm_ ``%r = stat(%0,(struct stat *)%1);'' name bytes
if rc == 0
then stToIO (unsafeFreezeByteArray bytes)
else fail (IOError Nothing SystemError "
Directory.
getFileStatus")
else fail (IOError Nothing SystemError "getFileStatus"
""
)
modificationTime :: FileStatus -> IO ClockTime
modificationTime stat = do
...
...
This diff is collapsed.
Click to expand it.
ghc/lib/std/System.lhs
+
5
−
5
View file @
cf27ce2f
...
...
@@ -79,7 +79,7 @@ getEnv name = do
litstring <- _ccall_ getenv name
if litstring /= ``NULL''
then return (unpackCString litstring)
else fail (IOError Nothing NoSuchThing
else fail (IOError Nothing NoSuchThing
"getEnv"
("environment variable: " ++ name))
\end{code}
...
...
@@ -97,7 +97,7 @@ The implementation does not support system calls.
\end{itemize}
\begin{code}
system "" = fail (IOError Nothing InvalidArgument "null command")
system "" = fail (IOError Nothing InvalidArgument
"system"
"null command")
system cmd = do
status <- _ccall_ systemCmd cmd
case status of
...
...
@@ -114,13 +114,13 @@ Before it terminates, any open or semi-closed handles are first closed.
\begin{code}
exitWith ExitSuccess = do
_ccall_ EXIT (0::Int)
fail (IOError Nothing OtherError "exit should not return")
fail (IOError Nothing OtherError
"exitWith"
"exit should not return")
exitWith (ExitFailure n)
| n == 0 = fail (IOError Nothing InvalidArgument "ExitFailure 0")
| n == 0 = fail (IOError Nothing InvalidArgument
"exitWith"
"ExitFailure 0")
| otherwise = do
_ccall_ EXIT n
fail (IOError Nothing OtherError "exit should not return")
fail (IOError Nothing OtherError
"exitWith"
"exit should not return")
\end{code}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment