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
a28b8057
Commit
a28b8057
authored
28 years ago
by
Simon Peyton Jones
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-03-18 17:00:20 by simonpj]
Add Locale.lhs
parent
2494407a
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ghc/lib/required/IO.lhs
+18
-6
18 additions, 6 deletions
ghc/lib/required/IO.lhs
ghc/lib/required/Locale.lhs
+39
-0
39 additions, 0 deletions
ghc/lib/required/Locale.lhs
with
57 additions
and
6 deletions
ghc/lib/required/IO.lhs
+
18
−
6
View file @
a28b8057
...
...
@@ -277,7 +277,7 @@ lazyReadLine :: Handle -> PrimIO String
lazyReadChar :: Handle -> PrimIO String
lazyReadBlock handle =
ioToST (readHandle handle)
>>= \ htype ->
ioToST (readHandle handle)
>>= \ htype ->
case htype of
-- There cannae be an ErrorHandle here
ClosedHandle ->
...
...
@@ -305,7 +305,7 @@ lazyReadBlock handle =
returnPrimIO (unpackPS some ++ more)
lazyReadLine handle =
ioToST (readHandle handle) >>= \ htype ->
ioToST (readHandle handle)
>>= \ htype ->
case htype of
-- There cannae be an ErrorHandle here
ClosedHandle ->
...
...
@@ -333,7 +333,7 @@ lazyReadLine handle =
returnPrimIO (unpackPS some ++ more)
lazyReadChar handle =
ioToST (readHandle handle) >>= \ htype ->
ioToST (readHandle handle)
>>= \ htype ->
case htype of
-- There cannae be an ErrorHandle here
ClosedHandle ->
...
...
@@ -355,6 +355,7 @@ lazyReadChar handle =
unsafeInterleavePrimIO (lazyReadChar handle)
>>= \ more ->
returnPrimIO (chr char : more)
\end{code}
...
...
@@ -417,10 +418,21 @@ hPutStr handle str =
writeHandle handle htype >>
fail (IOError (Just handle) IllegalOperation "handle is not open for writing")
other ->
{-
The code below is not correct for line-buffered terminal streams,
as the output stream is not flushed when terminal input is requested
again, just upon seeing a newline character. A temporary fix for the
most common line-buffered output stream, stdout, is to assume the
buffering it was given when created (no buffering). This is not
as bad as it looks, since stdio buffering sits underneath this.
ToDo: fix me
-}
getBufferMode other `thenIO_Prim` \ other ->
(case bufferMode other of
Just LineBuffering ->
writeLines (filePtr other) str
writeChars (filePtr other) str
--writeLines (filePtr other) str
Just (BlockBuffering (Just size)) ->
writeBlocks (filePtr other) size str
Just (BlockBuffering Nothing) ->
...
...
@@ -486,8 +498,8 @@ hPutStr handle str =
((C# x):xs) ->
write_char arr# n x >>
{- Flushing lines - should we bother? -}
if n ==# bufLen
{-
|| (chopOnNewLine && (x `eqChar#` '\n'#))
-}
then
{- Flushing lines - should we bother?
Yes, for line-buffered output.
-}
if n ==# bufLen || (chopOnNewLine && (x `eqChar#` '\n'#)) then
_ccall_ writeFile arr fp (I# (n +# 1#)) >>= \ rc ->
if rc == 0 then
shoveString 0# xs
...
...
This diff is collapsed.
Click to expand it.
ghc/lib/required/Locale.lhs
0 → 100644
+
39
−
0
View file @
a28b8057
%
% (c) The GRASP/AQUA Project, Glasgow University, 1995-97
%
\section[Time]{Haskell 1.4 Locale Library}
\begin{code}
module Locale(TimeLocale(..), defaultTimeLocale) where
data TimeLocale = TimeLocale {
wDays :: [(String, String)], -- full and abbreviated week days
months :: [(String, String)], -- full and abbreviated months
amPm :: (String, String), -- AM/PM symbols
dateTimeFmt, dateFmt, -- formatting strings
timeFmt, time12Fmt :: String
} deriving (Eq, Ord, Show)
defaultTimeLocale :: TimeLocale
defaultTimeLocale = TimeLocale {
wDays = [("Sunday", "Sun"), ("Monday", "Mon"),
("Tuesday", "Tue"), ("Wednesday", "Wed"),
("Thursday", "Thu"), ("Friday", "Fri"),
("Saturday", "Sat")],
months = [("January", "Jan"), ("February", "Feb"),
("March", "Mar"), ("April", "Apr"),
("May", "May"), ("June", "Jun"),
("July", "Jul"), ("August", "Aug"),
("September", "Sep"), ("October", "Oct"),
("November", "Nov"), ("December", "Dec")],
amPm = ("AM", "PM"),
dateTimeFmt = "%a %b %e %H:%M:%S %Z %Y",
dateFmt = "%m/%d/%y",
timeFmt = "%H:%M:%S",
time12Fmt = "%I:%M:%S %p"
}
\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