Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
array
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Vladislav Zavialov
array
Commits
592e8d18
Commit
592e8d18
authored
17 years ago
by
Ian Lynagh
Browse files
Options
Downloads
Patches
Plain Diff
Move Foldable and Traversable instances for Array to Data.Array
parent
0a9e596c
Branches
mergify/bp/3.10/pr-9242
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Data/Array.hs
+11
-2
11 additions, 2 deletions
Data/Array.hs
with
11 additions
and
2 deletions
Data/Array.hs
+
11
−
2
View file @
592e8d18
{-# OPTIONS_GHC -fno-implicit-prelude #-}
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- |
-- |
-- Module : Data.Array
-- Module : Data.Array
...
@@ -58,7 +57,7 @@ module Data.Array
...
@@ -58,7 +57,7 @@ module Data.Array
import
Data.Ix
import
Data.Ix
#
ifdef
__GLASGOW_HASKELL__
#
ifdef
__GLASGOW_HASKELL__
import
GHC.Arr
-- Most of the hard work is done here
import
GHC.Arr
-- Most of the hard work is done here
import
Data.Generics.Basics
-- To provide a Data instance
import
Data.Generics.Basics
-- To provide a Data instance
import
Data.Generics.Instances
-- To provide a Data instance
import
Data.Generics.Instances
-- To provide a Data instance
import
GHC.Err
(
error
)
-- Needed for Data instance
import
GHC.Err
(
error
)
-- Needed for Data instance
...
@@ -72,7 +71,10 @@ import Hugs.Array
...
@@ -72,7 +71,10 @@ import Hugs.Array
import
Array
-- Haskell'98 arrays
import
Array
-- Haskell'98 arrays
#
endif
#
endif
import
Control.Applicative
import
Data.Foldable
import
Data.Typeable
import
Data.Typeable
import
Data.Traversable
{- $intro
{- $intro
Haskell provides indexable /arrays/, which may be thought of as functions
Haskell provides indexable /arrays/, which may be thought of as functions
...
@@ -86,3 +88,10 @@ Since most array functions involve the class 'Ix', this module is exported
...
@@ -86,3 +88,10 @@ Since most array functions involve the class 'Ix', this module is exported
from "Data.Array" so that modules need not import both "Data.Array" and
from "Data.Array" so that modules need not import both "Data.Array" and
"Data.Ix".
"Data.Ix".
-}
-}
instance
Ix
i
=>
Foldable
(
Array
i
)
where
foldr
f
z
=
Prelude
.
foldr
f
z
.
elems
instance
Ix
i
=>
Traversable
(
Array
i
)
where
traverse
f
arr
=
listArray
(
bounds
arr
)
<$>
traverse
f
(
elems
arr
)
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