Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: (SPAM 3)Re: database, list result, extraction and
conversion (Bill Kunyiha)
2. Re: (SPAM 3)Re: (SPAM 3)Re: database, list result,
extraction and conversion (Damien Mattei)
3. Re: (SPAM 3)Re: (SPAM 3)Re: database, list result,
extraction and conversion (Francesco Ariis)
4. Re: database, list result, extraction and conversion
(Damien Mattei)
----------------------------------------------------------------------
Message: 1
Date: Thu, 6 Dec 2018 12:03:42 -0800
From: Bill Kunyiha <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] (SPAM 3)Re: database, list result,
extraction and conversion
Message-ID:
<capq8cx9bmo05u_m1chgek47x2qhmtysugooxrsv+3nwqzkm...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Thank you for reaching out to me.
Is this a remote position?
I live in Los Angeles and cannot relocate.
Thank You
Bill Kunyiha
On Thu, Dec 6, 2018 at 8:10 AM Francesco Ariis <[email protected]> wrote:
> 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
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20181206/ea1bcf68/attachment-0001.html>
------------------------------
Message: 2
Date: Fri, 7 Dec 2018 09:44:03 +0100
From: Damien Mattei <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] (SPAM 3)Re: (SPAM 3)Re: database,
list result, extraction and conversion
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
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
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
------------------------------
Message: 3
Date: Fri, 7 Dec 2018 09:59:56 +0100
From: Francesco Ariis <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] (SPAM 3)Re: (SPAM 3)Re: database,
list result, extraction and conversion
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Fri, Dec 07, 2018 at 09:44:03AM +0100, Damien Mattei wrote:
> 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...
So put this in your code
let noBD = map _ bd_rows
`_` will tell the compiler "tell me which type goes there". Then you
can choose the appropriate function!
------------------------------
Message: 4
Date: Fri, 7 Dec 2018 10:33:27 +0100
From: Damien Mattei <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] database, list result, extraction and
conversion
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
yes thanks you
i had swapped the arguments of map in my code, i lack sleeping those days
this solution worked :
let resLst = Prelude.map fromOnly bd_rows
but not this:
let noBD2 = Prelude.map _ bd_rows
Prelude> :load UpdateSidonie
[1 of 1] Compiling Main ( UpdateSidonie.hs, interpreted )
UpdateSidonie.hs:94:29: error:
• Found hole: _ :: Only Text -> b
Where: ‘b’ is a rigid type variable bound by
the inferred type of noBD2 :: [b]
at UpdateSidonie.hs:94:9-37
• In the first argument of ‘Prelude.map’, namely ‘_’
In the expression: Prelude.map _ bd_rows
In an equation for ‘noBD2’: noBD2 = Prelude.map _ bd_rows
• Relevant bindings include
noBD2 :: [b] (bound at UpdateSidonie.hs:94:9)
noBD :: Text (bound at UpdateSidonie.hs:93:9)
resLst :: [Text] (bound at UpdateSidonie.hs:91:9)
bd_rows :: [Only Text] (bound at UpdateSidonie.hs:86:5)
qry_head :: Query (bound at UpdateSidonie.hs:79:9)
qry :: [Char] (bound at UpdateSidonie.hs:77:9)
(Some bindings suppressed; use -fmax-relevant-binds=N or
-fno-max-relevant-binds)
Valid substitutions include
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
(imported from ‘Prelude’ at UpdateSidonie.hs:1:1
(and originally defined in ‘GHC.Err’))
|
94 | let noBD2 = Prelude.map _ bd_rows
| ^
Failed, no modules loaded.
it's annoying ,since i add 'import' ,i must Prelude.* basic functions:
import Database.MySQL.Simple
import Database.MySQL.Simple.QueryResults
import Database.MySQL.Simple.Result
import Control.Monad
import Data.Text
i must use Prelude.map, Prelude.head
is there a solution to this problem?
Le 07/12/2018 09:59, Francesco Ariis a écrit :
> On Fri, Dec 07, 2018 at 09:44:03AM +0100, Damien Mattei wrote:
>> 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...
>
> So put this in your code
>
> let noBD = map _ bd_rows
>
> `_` will tell the compiler "tell me which type goes there". Then you
> can choose the appropriate function!
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
--
[email protected], [email protected], UNS / OCA / CNRS
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 126, Issue 6
*****************************************