[Haskell-cafe] (SPAM 3)Re: fmap use

Damien Mattei mattei at oca.eu
Fri Dec 14 15:32:03 UTC 2018


yes i must admit but things are more and more weirds....

non i do not know why the first of those lines is OK and the other not
for compilation:


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

 bd_rows_WDS <- query conn qry_head_WDS (Only (name::String))

note:if i swap the order it always the line with qry_head_WDS that fails:

*Main> :load UpdateSidonie
[1 of 1] Compiling Main             ( UpdateSidonie.hs, interpreted )

UpdateSidonie.hs:202:20: error:
    • Ambiguous type variable ‘r0’ arising from a use of ‘query’
      prevents the constraint ‘(QueryResults r0)’ from being solved.
      Probable fix: use a type annotation to specify what ‘r0’ should be.
      These potential instances exist:
        instance Result a => QueryResults (Only a)
          -- Defined in ‘Database.MySQL.Simple.QueryResults’
        instance (Result a, Result b) => QueryResults (a, b)
          -- Defined in ‘Database.MySQL.Simple.QueryResults’
        instance (Result a, Result b, Result c) => QueryResults (a, b, c)
          -- Defined in ‘Database.MySQL.Simple.QueryResults’
        ...plus 21 others
        (use -fprint-potential-instances to see them all)
    • In a stmt of a 'do' block:
        bd_rows_WDS <- query conn qry_head_WDS (Only (name :: String))
      In the expression:
        do conn <- connect
                     defaultConnectInfo
                       {connectHost = "moita", connectUser = "mattei",
                        connectPassword = "sidonie2", connectDatabase =
"sidonie"}
           rows <- query_
                     conn
                     "SELECT Nom,distance FROM AngularDistance WHERE
distance > 0.000278"
           let lg = Prelude.length rows
           let tst = ...
           ....
      In an equation for ‘main’:
          main
            = do conn <- connect
                           defaultConnectInfo
                             {connectHost = "moita", connectUser = "mattei",
                              connectPassword = "sidonie2",
connectDatabase = "sidonie"}
                 rows <- query_
                           conn
                           "SELECT Nom,distance FROM AngularDistance
WHERE distance > 0.000278"
                 let lg = ...
                 ....
    |
202 |     bd_rows_WDS <- query conn qry_head_WDS (Only (name::String))
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.


for the curious i attach the whole code (UpdateSidonie.hs), i'm really
tired of Haskell....

i hope with the file it will be more easy to help me...

Le 14/12/2018 16:14, Brandon Allbery a écrit :
> On Fri, Dec 14, 2018 at 9:36 AM Damien Mattei <mattei at oca.eu
> <mailto:mattei at oca.eu>> wrote:
> 
>     in fact due to lazy evaluation i'm not sure it compiles all the code
>     because a more simple example give compilation errors:
> 
> 
> Er? Lazy evaluation has nothing to do with what gets compiled; the only
> way the compiler doesn't "compile all the code" is if you are using the
> CPP extension and #ifdef etc. to exclude some.
> 
> -- 
> brandon s allbery kf8nh
> allbery.b at gmail.com <mailto:allbery.b at gmail.com>

-- 
Damien.Mattei at unice.fr, Damien.Mattei at oca.eu, UNS / OCA / CNRS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UpdateSidonie.hs
Type: text/x-haskell
Size: 8181 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20181214/4947ce62/attachment.hs>


More information about the Haskell-Cafe mailing list