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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
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
Tobias Decking
GHC
Commits
9c7a7ae8
Commit
9c7a7ae8
authored
Feb 02, 1999
by
simonm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[project @ 1999-02-02 17:37:39 by simonm]
Optimise take a little.
parent
16eb5dec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
11 deletions
+23
-11
ghc/lib/std/PrelList.lhs
ghc/lib/std/PrelList.lhs
+21
-9
ghc/lib/std/PrelNumExtra.lhs
ghc/lib/std/PrelNumExtra.lhs
+1
-1
ghc/lib/std/Prelude.lhs
ghc/lib/std/Prelude.lhs
+1
-1
No files found.
ghc/lib/std/PrelList.lhs
View file @
9c7a7ae8
...
...
@@ -24,7 +24,7 @@ module PrelList (
-- non-standard, but hidden when creating the Prelude
-- export list.
takeUInt
takeUInt
_append
) where
...
...
@@ -205,23 +205,35 @@ splitAt _ _ = errorNegativeIdx "splitAt"
#else /* hack away */
take :: Int -> [b] -> [b]
take (I# n#) xs = takeUInt n# xs
[]
take (I# n#) xs = takeUInt n# xs
-- The general code for take, below, checks n <= maxInt
-- No need to check for maxInt overflow when specialised
-- at type Int or Int# since the Int must be <= maxInt
takeUInt :: Int# -> [b] -> [b]
-> [b]
takeUInt n xs
rs
| n >=# 0# = take_unsafe_UInt n xs
rs
takeUInt :: Int# -> [b] -> [b]
takeUInt n xs
| n >=# 0# = take_unsafe_UInt n xs
| otherwise = errorNegativeIdx "take"
take_unsafe_UInt :: Int# -> [b] -> [b] -> [b]
take_unsafe_UInt 0# _ rs = rs
take_unsafe_UInt m ls rs =
take_unsafe_UInt :: Int# -> [b] -> [b]
take_unsafe_UInt 0# _ = []
take_unsafe_UInt m ls =
case ls of
[] -> []
(x:xs) -> x : take_unsafe_UInt (m -# 1#) xs
takeUInt_append :: Int# -> [b] -> [b] -> [b]
takeUInt_append n xs rs
| n >=# 0# = take_unsafe_UInt_append n xs rs
| otherwise = errorNegativeIdx "take"
take_unsafe_UInt_append :: Int# -> [b] -> [b] -> [b]
take_unsafe_UInt_append 0# _ rs = rs
take_unsafe_UInt_append m ls rs =
case ls of
[] -> rs
(x:xs) -> x : take_unsafe_UInt (m -# 1#) xs rs
(x:xs) -> x : take_unsafe_UInt
_append
(m -# 1#) xs rs
drop :: Int -> [b] -> [b]
drop (I# n#) ls
...
...
ghc/lib/std/PrelNumExtra.lhs
View file @
9c7a7ae8
...
...
@@ -551,7 +551,7 @@ prR n r e0
s@(h:t) = show ((round (r * 10^n))::Integer)
e = e0+1
takeN (I# n#) ls rs = takeUInt n# ls rs
takeN (I# n#) ls rs = takeUInt
_append
n# ls rs
drop0 :: String -> String -> String
drop0 [] rs = rs
...
...
ghc/lib/std/Prelude.lhs
View file @
9c7a7ae8
...
...
@@ -66,7 +66,7 @@ module Prelude (
) where
import PrelBase
import PrelList hiding ( takeUInt )
import PrelList hiding ( takeUInt
_append
)
import PrelRead
import PrelNum
import PrelNumExtra
...
...
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