[Haskell-beginners] (SPAM 3)Re: (SPAM 3)Re: database, list result, extraction and conversion
Damien Mattei
mattei at oca.eu
Fri Dec 7 08:44:03 UTC 2018
let noBD = fromOnly (Prelude.head bd_rows)
give me a solution, but i'm still searching a solution with map has in a
list there could be more than one result...
D
Le 06/12/2018 17:10, Francesco Ariis a écrit :
> On Thu, Dec 06, 2018 at 03:54:45PM +0100, Damien Mattei wrote:
>> if it was so easy!
>
> Damien, you must heed the compiler!
heed?
>
>> 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
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
More information about the Beginners
mailing list