[Haskell-beginners] (SPAM 3)Re: database, list result, extraction and conversion

Francesco Ariis fa-ml at ariis.it
Thu Dec 6 16:10:00 UTC 2018


On Thu, Dec 06, 2018 at 03:54:45PM +0100, Damien Mattei wrote:
> if it was so easy!

Damien, you must heed the compiler!

> UpdateSidonie.hs:93:25: error:
>     • Couldn't match expected type ‘Only a’
>                   with actual type ‘[Only Text]’
>     • In the first argument of ‘fromOnly’, namely ‘bd_rows’
>       In the expression: fromOnly bd_rows
>       In an equation for ‘noBD’: noBD = fromOnly bd_rows
>     • Relevant bindings include
>         noBD :: a (bound at UpdateSidonie.hs:93:9)
>    |
> 93 |     let noBD = fromOnly bd_rows
>    |                         ^^^^^^^
> Failed, no modules loaded.

So you applied `fromOnly` to `bd_rows`. fromOnly has type

    fromOnly :: Only a -> a

Now GHC is complaining:

      • I was expecting ‘Only a’
              but you gave me ‘[Only Text]’

So either call "head" on [Only Text] (unsafe!) or map over it.
See if it works and if not, fire again here
-F


More information about the Beginners mailing list