Custom Query (6603 matches)


Show under each result:

Results (1 - 3 of 6603)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#9008 fixed Data.Function: Add reverse application operator bernalex
#9006 fixed GHC accepts import of private data constructor if it has the same name as the type Lemming
$ cat A.hs B.hs
module A (T) where

data T = T

module B where

import A (T(T))

ghci-7.8.2 accepts module B, whereas ghci-7.6.3 and ghci-7.4.2 say:

B.hs:3:11: Module `A' does not export `T(T)'

For this bug to happen it is important, that the data constructor has the same name as the type. I.e. if you rename the data constructor to, say, Cons, then ghci-7.8.2 will emit the same error as earlier versions. The bug is not dramatic, since if you try to actually use the imported data constructor then ghc will say

    Not in scope: data constructor ‘T’

However this error message is very confusing, because it suggests that T is not in scope although you imported it correctly.

#9004 fixed Add sortOn function to Data.List JohnWiegley

The following passed for two weeks on the libraries mailing list without any dissenting votes.

The request is to add the following function to Data.List:

-- | Sort a list by comparing the results of a key function applied to each
--   element.  @sortOn f@ is equivalent to @sortBy . comparing f@, but has the
--   performance advantage of only evaluating @f@ once for each element in the
--   input list.  This is called the decorate-sort-undecorate paradigm, or
--   Schwartzian transform.
sortOn :: Ord b => (a -> b) -> [a] -> [a]
sortOn f = map snd . sortBy (comparing fst)
                   . map (\x -> let y = f x in y `seq` (y, x))
1 2 3 4 5 6 7 8 9 10 11
Note: See TracQuery for help on using queries.