[Haskell-beginners] (SPAM 3)Re: database error simply by using a sting in a variable

Damien Mattei mattei at oca.eu
Wed Dec 5 16:28:03 UTC 2018



Le 05/12/2018 17:12, Francesco Ariis a écrit :
> Hello Damien,
> 
> On Wed, Dec 05, 2018 at 05:02:48PM +0100, Damien Mattei wrote:
>>     • Couldn't match expected type ‘Query’ with actual type ‘[Char]’
> 
> GHC would like to have a `Query`, but you are providing a `String`.
> You didn't specify which library you are using, but I am willing to
> bet there is an appropriate ":: String -> Query" function.
> 
> That of you need to put
> 
>     {-# Language OverloadedStrings -#}


i had put it alreeady
> 
> on top of your file. Does that work?

no

i begin to understand that {-# Language OverloadedStrings -#} is working
on string but not on string in variable or concatenation , i should have
to create an object of type Query from the String... ???

finally ,having a beginning of solution:

  let qry_head = "select `N° BD` from sidonie.Coordonnées where Nom = ?"
:: Query
    putStrLn qry

    bd_rows <- query conn qry_head (Only (name::String))

> -F
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 

-- 
Damien.Mattei at unice.fr, Damien.Mattei at oca.eu, UNS / OCA / CNRS


More information about the Beginners mailing list