
Where do I find foldl' in GHC? It's mentioned on http://www.haskell.org/ghc/docs/latest/html/base/Data.List.html but importing List and using "-package data" don't seem to make it appear. I'm using GHC 5.02.2. I must be making some simple mistake. -- Mark

If it appears in Data.List then you need to import Data.List. In order to do this, you will need a newer (>=5.03) version of GHC, if I'm not mistaken. - Hal -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On Sat, 16 Nov 2002, Mark Carroll wrote:
Where do I find foldl' in GHC? It's mentioned on http://www.haskell.org/ghc/docs/latest/html/base/Data.List.html but importing List and using "-package data" don't seem to make it appear. I'm using GHC 5.02.2. I must be making some simple mistake.
-- Mark
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Sat, 16 Nov 2002, Hal Daume III wrote:
If it appears in Data.List then you need to import Data.List. In order to do this, you will need a newer (>=5.03) version of GHC, if I'm not mistaken.
I find it curious that I can do: cicero:markc$ ghci -package data ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 5.04, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Loading package haskell98 ... linking ... done. Loading package lang ... linking ... done. Loading package concurrent ... linking ... done. Loading package posix ... linking ... done. Loading package util ... linking ... done. Loading package data ... linking ... done. Prelude> :type FiniteMap.lookupFM forall key elt. (Ord key) => Data.FiniteMap.FiniteMap key elt -> key -> Maybe elt Prelude> :type List.isSuffixOf forall a. (Eq a) => [a] -> [a] -> Bool Prelude> :type List.foldl' <interactive>:1: Variable not in scope: `List.foldl'' Prelude> How come I can get at lookupFM and isSuffixOf but not foldl'? (-: (Thanks to you and Richard for replies!) -- Mark

Because List is the H98 module, Data.List is the extended one which contains foldl'. Regardless of whether you say -package data or not, you're not going to get Data.List unless you ask for it explicitly: moussor:multidoc-sum/ ghci -package data ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 5.04.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Loading package haskell98 ... linking ... done. Loading package lang ... linking ... done. Loading package concurrent ... linking ... done. Loading package posix ... linking ... done. Loading package util ... linking ... done. Loading package data ... linking ... done. Prelude> :t List.foldl' <interactive>:1: Variable not in scope: `List.foldl'' Prelude> :t Data.List.foldl' forall a b. (a -> b -> a) -> a -> [b] -> a Prelude> -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On Fri, 22 Nov 2002, Mark Carroll wrote:
On Sat, 16 Nov 2002, Hal Daume III wrote:
If it appears in Data.List then you need to import Data.List. In order to do this, you will need a newer (>=5.03) version of GHC, if I'm not mistaken.
I find it curious that I can do:
cicero:markc$ ghci -package data ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 5.04, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done. Loading package haskell98 ... linking ... done. Loading package lang ... linking ... done. Loading package concurrent ... linking ... done. Loading package posix ... linking ... done. Loading package util ... linking ... done. Loading package data ... linking ... done. Prelude> :type FiniteMap.lookupFM forall key elt. (Ord key) => Data.FiniteMap.FiniteMap key elt -> key -> Maybe elt Prelude> :type List.isSuffixOf forall a. (Eq a) => [a] -> [a] -> Bool Prelude> :type List.foldl'
<interactive>:1: Variable not in scope: `List.foldl'' Prelude>
How come I can get at lookupFM and isSuffixOf but not foldl'? (-:
(Thanks to you and Richard for replies!)
-- Mark
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Fri, 22 Nov 2002, Hal Daume III wrote:
Because List is the H98 module, Data.List is the extended one which contains foldl'. Regardless of whether you say -package data or not, you're not going to get Data.List unless you ask for it explicitly: (snip)
Thanks very much indeed! I finally have it working. (-: -- Mark

I don't know if this will help, but I am using GHC Interactive, version 5.03, for Haskell 98, and I wanted to use the 'toUpper' function. 'toUpper' is defined in Data.Char, but is not loaded when ghci is started: Prelude> :info toUpper Variable not in scope: `toUpper' To bring 'toUpper' into scope, I put "import Char" in my program (a very simple program named "Text1.hs"): module Text1 where import Char f = Char.toUpper 'a' After starting ghci from the operating system shell, I enter ":load <program name>" at the ghci prompt, then evaluate the function 'f': [localhost:~/Documents/myHaskellProgs] richard% ghci . . . Loading package base ... linking ... done. Loading package haskell98 ... linking ... done. Prelude> :load Text1.hs Compiling Text1 ( Text1.hs, interpreted ) Ok, modules loaded: Text1. *Text1> f 'A' *Text1> Richard E. Adams Email: r.adams@computer.org (or) radams@iglide.net On Saturday, November 16, 2002, at 06:55 AM, Mark Carroll wrote:
Where do I find foldl' in GHC? It's mentioned on http://www.haskell.org/ghc/docs/latest/html/base/Data.List.html but importing List and using "-package data" don't seem to make it appear. I'm using GHC 5.02.2. I must be making some simple mistake.
-- Mark
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (3)
-
Hal Daume III
-
Mark Carroll
-
Richard E.Adams