[GHC] #10142: Documentation for Ix is contradictory around minimal definition
GHC
ghc-devs at haskell.org
Sat Mar 7 10:56:23 UTC 2015
#10142: Documentation for Ix is contradictory around minimal definition
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: hvr
Type: bug | Status: new
Priority: normal | Milestone:
Component: Core Libraries | Version: 7.8.4
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by hvr):
* owner: ekmett => hvr
Comment:
so while `range` and `inRange` have no default implementation, `index` has
one that is recursive:
{{{#!hs
-- Must specify one of index, unsafeIndex
-- 'index' is typically over-ridden in instances, with essentially
-- the same code, but using indexError instead of
hopelessIndexError
-- Reason: we have 'Show' at the instances
{-# INLINE index #-} -- See Note [Inlining index]
index b i | inRange b i = unsafeIndex b i
| otherwise = hopelessIndexError
unsafeIndex b i = index b i
}}}
So the minimal pragma should specify that we minimally need
{{{
range && inRange && (index || unsafeIndex)
}}}
I'll make a patch rightaway...
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10142#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list