ndmitchell: > Hi > > Eeek, a solution that does monadic maps and require's rank 2 types! > > arr = [('a',1), ('b',2), ('c',3)] > showAll = lines (map showItem arr) > showItem (a,n) = a : " = " ++ show n > main = putStr showAll > > I've broken this up a bit more than usual - most people would probably > just put showAll inside main, but this separates out the concepts. arr > is the data, which you could construct with a zip if that really is > all there is to it. showItem shows a single item, showAll shows them > all, and main just prints out the information. > > And this solution is Haskell 98, anything that uses printf is Haskell' only. > > Thanks > > Neil
$ hugs +98 __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: March 2005 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Hugs.Base> :l Text.Printf Text.Printf> printf "%d" (1::Int) :: String "1" Fix YHC! :-) -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe