Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  database, list result, extraction and conversion
      (Francesco Ariis)
   2. Re:  Regex (David McBride)
   3. Re:  Regex (mike h)
   4. Re:  Regex (mike h)
   5. Re:  (SPAM 3)Re:  database, list result, extraction and
      conversion (Damien Mattei)
   6. Re:  (SPAM 3)Re:  database, list result, extraction and
      conversion (Francesco Ariis)


----------------------------------------------------------------------

Message: 1
Date: Thu, 6 Dec 2018 14:07:40 +0100
From: Francesco Ariis <fa...@ariis.it>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] database, list result, extraction and
        conversion
Message-ID: <20181206130740.rkgddr6x5av7n...@x60s.casa>
Content-Type: text/plain; charset=us-ascii

On Thu, Dec 06, 2018 at 12:16:08PM +0100, Damien Mattei wrote:
> *Main> show s
> "Only {fromOnly = \"-04.3982\"}"
> 
> but how can i get the String "-04.3982" ? and after converting it to a
> Float?

I suspect that "fromOnly" accessor will do!

http://hackage.haskell.org/package/mysql-simple-0.4.5/docs/Database-MySQL-Simple.html#t:Only




------------------------------

Message: 2
Date: Thu, 6 Dec 2018 08:44:45 -0500
From: David McBride <toa...@gmail.com>
To: Haskell Beginners <Beginners@haskell.org>
Subject: Re: [Haskell-beginners] Regex
Message-ID:
        <CAN+Tr43AVKi5nZNvQApKhHzPu-B0Br=uwnjxmpdso7e9hea...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

In Haskell virtually everyone uses parser combinator libraries like parsec,
megaparsec, or attoparsec depending on their needs.

Many people ask this question and are then disappointed when they can't
find a definitively standard regex library to use. That's because they are
barely needed.

That's not to say that there are no such libraries
  There are. But I personally couldn't suggest any as I have not been
compelled to use one in many years.

On Thu, Dec 6, 2018, 05:38 mike h <mike_k_hough...@yahoo.co.uk wrote:

> Hi,
>
> Which package is the most popular and/or easy to used for dealing with
> regular expressions?
> My regex is quite simple and I just need to get 2 or 3 capture groups from
> the result.
>
> Many thanks
>
> Mike
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> 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/2ac6acf4/attachment-0001.html>

------------------------------

Message: 3
Date: Thu, 6 Dec 2018 13:53:44 +0000 (UTC)
From: mike h <mike_k_hough...@yahoo.co.uk>
To: Haskell Beginners <Beginners@haskell.org>,  The Haskell-Beginners
        Mailing List - Discussion of primarily beginner-level topics related
        to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Regex
Message-ID: <1613373168.5016348.1544104424...@mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"

 
:) I get a real buzz out of writing parser combinators. So, perversely - if 
only to broaden my Haskell knowledge, I decided to try using regexs. LOL
I'll see where this takes me!
Thanks 

Mike

    On Thursday, 6 December 2018, 13:45:21 GMT, David McBride 
<toa...@gmail.com> wrote:  
 
 In Haskell virtually everyone uses parser combinator libraries like parsec, 
megaparsec, or attoparsec depending on their needs.
Many people ask this question and are then disappointed when they can't find a 
definitively standard regex library to use. That's because they are barely 
needed.
That's not to say that there are no such libraries  There are. But I personally 
couldn't suggest any as I have not been compelled to use one in many years.
On Thu, Dec 6, 2018, 05:38 mike h <mike_k_hough...@yahoo.co.uk wrote:

Hi,

Which package is the most popular and/or easy to used for dealing with regular 
expressions?
My regex is quite simple and I just need to get 2 or 3 capture groups from the 
result.

Many thanks

Mike
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
Beginners@haskell.org
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/0c949b5f/attachment-0002.html>

------------------------------

Message: 4
Date: Thu, 6 Dec 2018 13:53:44 +0000 (UTC)
From: mike h <mike_k_hough...@yahoo.co.uk>
To: Haskell Beginners <Beginners@haskell.org>,  The Haskell-Beginners
        Mailing List - Discussion of primarily beginner-level topics related
        to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Regex
Message-ID: <1613373168.5016348.1544104424...@mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"

 
:) I get a real buzz out of writing parser combinators. So, perversely - if 
only to broaden my Haskell knowledge, I decided to try using regexs. LOL
I'll see where this takes me!
Thanks 

Mike

    On Thursday, 6 December 2018, 13:45:21 GMT, David McBride 
<toa...@gmail.com> wrote:  
 
 In Haskell virtually everyone uses parser combinator libraries like parsec, 
megaparsec, or attoparsec depending on their needs.
Many people ask this question and are then disappointed when they can't find a 
definitively standard regex library to use. That's because they are barely 
needed.
That's not to say that there are no such libraries  There are. But I personally 
couldn't suggest any as I have not been compelled to use one in many years.
On Thu, Dec 6, 2018, 05:38 mike h <mike_k_hough...@yahoo.co.uk wrote:

Hi,

Which package is the most popular and/or easy to used for dealing with regular 
expressions?
My regex is quite simple and I just need to get 2 or 3 capture groups from the 
result.

Many thanks

Mike
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
Beginners@haskell.org
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/0c949b5f/attachment-0003.html>

------------------------------

Message: 5
Date: Thu, 6 Dec 2018 15:54:45 +0100
From: Damien Mattei <mat...@oca.eu>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] (SPAM 3)Re:  database, list result,
        extraction and conversion
Message-ID: <5c093835.9040...@oca.eu>
Content-Type: text/plain; charset=utf-8

if it was so easy!

GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
Prelude> fromOnly  [Only {fromOnly = "-04.3982"}]

<interactive>:1:12: error: Not in scope: data constructor ‘Only’


and in a program:

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

    putStrLn $ show bd_rows
    putStrLn $ show name

    let resLst = []

    let noBD = fromOnly bd_rows



    forM_ bd_rows $ \(Only a) ->
      putStrLn $  Data.Text.unpack a


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

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.




Le 06/12/2018 14:07, Francesco Ariis a écrit :
> On Thu, Dec 06, 2018 at 12:16:08PM +0100, Damien Mattei wrote:
>> *Main> show s
>> "Only {fromOnly = \"-04.3982\"}"
>>
>> but how can i get the String "-04.3982" ? and after converting it to a
>> Float?
> 
> I suspect that "fromOnly" accessor will do!
> 
> http://hackage.haskell.org/package/mysql-simple-0.4.5/docs/Database-MySQL-Simple.html#t:Only
> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 

-- 
damien.mat...@unice.fr, damien.mat...@oca.eu, UNS / OCA / CNRS


------------------------------

Message: 6
Date: Thu, 6 Dec 2018 17:10:00 +0100
From: Francesco Ariis <fa...@ariis.it>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] (SPAM 3)Re:  database, list result,
        extraction and conversion
Message-ID: <20181206161000.ys7d3mlo57xyq...@x60s.casa>
Content-Type: text/plain; charset=utf-8

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


------------------------------

Subject: Digest Footer

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


------------------------------

End of Beginners Digest, Vol 126, Issue 5
*****************************************

Reply via email to