
It's the monomorphism restriction again. Check out the section in the Haskell Report, which gives some motivation (4.5.4). Solution: make mytrim into a function or give a type signature to mytrim Simon | -----Original Message----- | From: brk@jenkon.com [mailto:brk@jenkon.com] | Sent: 28 August 2001 02:37 | To: glasgow-haskell-users@haskell.org | Subject: Simple implicit parameters question | | | Hi all, | | Using one implicit parameter works fine for me, but when I | use two, things seem to go astray. Here's a highly contrived example: | | main = | do | putStrLn $ mytrim with ?width = 20 with ?line = "The | quick brown fox jumped over the lazy dog" | | | mytrim | ?width > length ?line = ?line | | otherwise = take ?width ?line | | | But ghc complains: | | $ ghc -o scratch.exe scratch.hs -fglasgow-exts | | scratch.hs:8: | Unbound implicit parameter `?width :: Int' | arising from use of implicit parameter `?width' at scratch.hs:8 | In the first argument of `(>)', namely `?width' | In the definition of `mytrim': ?width > (length ?line) | | scratch.hs:8: | Unbound implicit parameter `?line :: [Char]' | arising from use of implicit parameter `?line' at scratch.hs:8 | In the first argument of `length', namely `?line' | In the second argument of `(>)', namely `length ?line' | | | Can someone please tell me what I'm doing wrong? | | Thanks, | | Bryn Keller | Senior Software Engineer | Jenkon | brk@jenkon.com | | | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-| haskell-users |