Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,242
Issues
4,242
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
387
Merge Requests
387
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
927e7d38
Commit
927e7d38
authored
Mar 15, 2000
by
andy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[project @ 2000-03-15 01:34:52 by andy]
Adding GHC style Dynamic to the Prelude understanding.
parent
51464cf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
21 deletions
+86
-21
ghc/lib/hugs/Prelude.hs
ghc/lib/hugs/Prelude.hs
+86
-21
No files found.
ghc/lib/hugs/Prelude.hs
View file @
927e7d38
...
...
@@ -688,7 +688,6 @@ instance Integral Int where
instance
Integral
Integer
where
quotRem
=
primQuotRemInteger
--divMod = primDivModInteger
toInteger
=
id
toInt
=
primIntegerToInt
...
...
@@ -1587,17 +1586,21 @@ instance Show IOError where
showsPrec
_
(
IOError
s
)
=
showString
(
"I/O error: "
++
s
)
ioError
::
IOError
->
IO
a
ioError
(
IOError
s
)
=
primRaise
(
IOExcept
s
)
ioError
e
@
(
IOError
_
)
=
primRaise
(
IOException
e
)
userError
::
String
->
IOError
userError
s
=
primRaise
(
ErrorCall
s
)
catch
::
IO
a
->
(
IOError
->
IO
a
)
->
IO
a
catch
m
k
=
IO
(
\
s
->
unIO
m
s
`
primCatch
`
\
err
->
unIO
(
k
(
e2ioe
err
))
s
)
where
e2ioe
(
IOExcept
s
)
=
IOError
s
e2ioe
other
=
IOError
(
show
other
)
throw
::
Exception
->
a
throw
exception
=
primRaise
exception
catchException
::
IO
a
->
(
Exception
->
IO
a
)
->
IO
a
catchException
m
k
=
IO
(
\
s
->
unIO
m
s
`
primCatch
`
\
err
->
unIO
(
k
err
)
s
)
catch
::
IO
a
->
(
IOError
->
IO
a
)
->
IO
a
catch
m
k
=
catchException
m
handler
where
handler
(
IOException
err
)
=
k
err
handler
other
=
throw
other
putChar
::
Char
->
IO
()
putChar
c
=
nh_stdout
>>=
\
h
->
nh_write
h
c
...
...
@@ -1677,14 +1680,80 @@ readLn = do l <- getLine
-- End of Hugs standard prelude ----------------------------------------------
data
Exception
=
ErrorCall
String
|
IOExcept
String
data
Exception
=
IOException
IOError
-- IO exceptions (from 'ioError')
|
ArithException
ArithException
-- Arithmetic exceptions
|
ErrorCall
String
-- Calls to 'error'
|
NoMethodError
String
-- A non-existent method was invoked
|
PatternMatchFail
String
-- A pattern match failed
|
NonExhaustiveGuards
String
-- A guard match failed
|
RecSelError
String
-- Selecting a non-existent field
|
RecConError
String
-- Field missing in record construction
|
RecUpdError
String
-- Record doesn't contain updated field
|
AssertionFailed
String
-- Assertions
|
DynException
Dynamic
-- Dynamic exceptions
|
AsyncException
AsyncException
-- Externally generated errors
|
PutFullMVar
-- Put on a full MVar
|
NonTermination
data
ArithException
=
Overflow
|
Underflow
|
LossOfPrecision
|
DivideByZero
|
Denormal
deriving
(
Eq
,
Ord
)
data
AsyncException
=
StackOverflow
|
HeapOverflow
|
ThreadKilled
deriving
(
Eq
,
Ord
)
stackOverflow
,
heapOverflow
::
Exception
-- for the RTS
stackOverflow
=
AsyncException
StackOverflow
heapOverflow
=
AsyncException
HeapOverflow
instance
Show
ArithException
where
showsPrec
_
Overflow
=
showString
"arithmetic overflow"
showsPrec
_
Underflow
=
showString
"arithmetic underflow"
showsPrec
_
LossOfPrecision
=
showString
"loss of precision"
showsPrec
_
DivideByZero
=
showString
"divide by zero"
showsPrec
_
Denormal
=
showString
"denormal"
instance
Show
AsyncException
where
showsPrec
_
StackOverflow
=
showString
"stack overflow"
showsPrec
_
HeapOverflow
=
showString
"heap overflow"
showsPrec
_
ThreadKilled
=
showString
"thread killed"
instance
Show
Exception
where
showsPrec
_
(
ErrorCall
s
)
=
showString
(
"error: "
++
s
)
showsPrec
_
(
IOExcept
s
)
=
showString
(
"I/O error: "
++
s
)
showsPrec
_
(
IOException
err
)
=
shows
err
showsPrec
_
(
ArithException
err
)
=
shows
err
showsPrec
_
(
ErrorCall
err
)
=
showString
err
showsPrec
_
(
NoMethodError
err
)
=
showString
err
showsPrec
_
(
PatternMatchFail
err
)
=
showString
err
showsPrec
_
(
NonExhaustiveGuards
err
)
=
showString
err
showsPrec
_
(
RecSelError
err
)
=
showString
err
showsPrec
_
(
RecConError
err
)
=
showString
err
showsPrec
_
(
RecUpdError
err
)
=
showString
err
showsPrec
_
(
AssertionFailed
err
)
=
showString
err
showsPrec
_
(
AsyncException
e
)
=
shows
e
showsPrec
_
(
DynException
_err
)
=
showString
"unknown exception"
showsPrec
_
(
PutFullMVar
)
=
showString
"putMVar: full MVar"
showsPrec
_
(
NonTermination
)
=
showString
"<<loop>>"
data
Dynamic
=
Dynamic
TypeRep
Obj
data
Obj
=
Obj
-- dummy type to hold the dynamically typed value.
data
TypeRep
=
App
TyCon
[
TypeRep
]
|
Fun
TypeRep
TypeRep
deriving
(
Eq
)
data
TyCon
=
TyCon
Int
String
instance
Eq
TyCon
where
(
TyCon
t1
_
)
==
(
TyCon
t2
_
)
=
t1
==
t2
data
IOResult
=
IOResult
deriving
(
Show
)
...
...
@@ -1777,7 +1846,10 @@ primGetEnv v
------------------------------------------------------------------------------
newtype
ST
s
a
=
ST
(
s
->
(
a
,
s
))
unST
::
ST
s
a
->
s
->
(
a
,
s
)
unST
(
ST
a
)
=
a
mkST
::
(
s
->
(
a
,
s
))
->
ST
s
a
mkST
=
ST
data
RealWorld
runST
::
(
__forall
s
.
ST
s
a
)
->
a
...
...
@@ -1785,13 +1857,6 @@ runST m = fst (unST m alpha)
where
alpha
=
error
"runST: entered the RealWorld"
fixST
::
(
a
->
ST
s
a
)
->
ST
s
a
fixST
m
=
ST
(
\
s
->
let
(
r
,
s
)
=
unST
(
m
r
)
s
in
(
r
,
s
))
instance
Functor
(
ST
s
)
where
fmap
f
x
=
x
>>=
(
return
.
f
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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