# Simple implicit parameters question

Simon Peyton-Jones simonpj@microsoft.com
Tue, 28 Aug 2001 00:55:31 -0700

```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=09
or	give a type signature to mytrim

Simon

| -----Original Message-----
| From: brk@jenkon.com [mailto:brk@jenkon.com]=20
| Sent: 28 August 2001 02:37
| Subject: Simple implicit parameters question
|=20
|=20
| Hi all,
|=20
| Using one implicit parameter works fine for me, but when I=20
| use two, things seem to go astray. Here's a highly contrived example:
|=20
| main =3D
|   do
|     putStrLn \$ mytrim with ?width =3D 20 with ?line =3D "The=20
| quick brown fox jumped over the lazy dog"
|=20
|=20
| mytrim | ?width > length ?line =3D ?line
|        | otherwise             =3D take ?width ?line
|=20
|=20
| But ghc complains:
|=20
| \$ ghc -o scratch.exe scratch.hs -fglasgow-exts
|=20
| 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)
|=20
| 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'
|=20
|=20
| Can someone please tell me what I'm doing wrong?
|=20
| Thanks,
|=20
| Bryn Keller
| Senior Software Engineer
| Jenkon
| brk@jenkon.com
|=20
|=20
| _______________________________________________
| Glasgow-haskell-users mailing list=20