Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/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:  sorting (kolli kolli)
   2. Re:  sorting (David McBride)
   3. Re:  quickCheck generation question (Joe Van Dyk)
   4.  Real World Haskell: From Portable to     System.Win32 (Paulo Pocinho)
   5. Re:  module not found (Stephen Tetley)


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

Message: 1
Date: Fri, 7 Oct 2011 21:51:12 -0600
From: kolli kolli <nammukoll...@gmail.com>
Subject: Re: [Haskell-beginners] sorting
To: Tom Murphy <amin...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <CAE7D9k6e77HR_PX=o-i4o9btii6wcd_qwvdg5bbadb7w7kq...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

i want the o/p to be ["ala", "jera","zero", "0020", "0030","0022"]

On Fri, Oct 7, 2011 at 9:45 PM, Tom Murphy <amin...@gmail.com> wrote:

> You want the number-strings to stay in the list? Can you show what that
> list would look like sorted?
>
> Tom/amindfv
> On Oct 7, 2011 10:18 PM, "kolli kolli" <nammukoll...@gmail.com> wrote:
>
>> what if i have ["ala", "0020", "zero", "00021" , "jera","0030"] and I want
>> to sort only the words and nt the numbers
>>
>> On Fri, Oct 7, 2011 at 8:53 PM, Felipe Almeida Lessa <
>> felipe.le...@gmail.com> wrote:
>>
>>> import Data.List
>>>
>>> s = sort ["ala", "zero", "jera"]
>>>
>>> -
>>> Felipe.
>>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners@haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20111007/b89326c2/attachment-0001.htm>

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

Message: 2
Date: Sat, 8 Oct 2011 00:05:58 -0400
From: David McBride <toa...@gmail.com>
Subject: Re: [Haskell-beginners] sorting
To: kolli kolli <nammukoll...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <can+tr41cgfszemuc-mbxy9wtjd2jl3t8steozuys57kxgvm...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Use the sortBy function to supply your own comparison function.

On Fri, Oct 7, 2011 at 11:51 PM, kolli kolli <nammukoll...@gmail.com> wrote:
> i want the o/p to be ["ala", "jera","zero", "0020", "0030","0022"]
>
> On Fri, Oct 7, 2011 at 9:45 PM, Tom Murphy <amin...@gmail.com> wrote:
>>
>> You want the number-strings to stay in the list? Can you show what that
>> list would look like sorted?
>>
>> Tom/amindfv
>>
>> On Oct 7, 2011 10:18 PM, "kolli kolli" <nammukoll...@gmail.com> wrote:
>>>
>>> what if i have?["ala", "0020", "zero", "00021" , "jera","0030"] and I
>>> want to sort only the words and nt the numbers
>>>
>>> On Fri, Oct 7, 2011 at 8:53 PM, Felipe Almeida Lessa
>>> <felipe.le...@gmail.com> wrote:
>>>>
>>>> import Data.List
>>>>
>>>> s = sort ["ala", "zero", "jera"]
>>>>
>>>> -
>>>> Felipe.
>>>
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners@haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners
>>>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>



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

Message: 3
Date: Fri, 7 Oct 2011 22:08:32 -0700
From: Joe Van Dyk <j...@fixieconsulting.com>
Subject: Re: [Haskell-beginners] quickCheck generation question
To: beginners <beginners@haskell.org>
Message-ID:
        <CACfv+pLgqh66=2g1f8P-nwvhR=e_cpxpw_u4kdhllrpwtwl...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Solved this:  
http://stackoverflow.com/questions/7693930/generating-a-lists-of-a-specific-length-with-haskells-quickcheck

On Fri, Oct 7, 2011 at 4:40 PM, Joe Van Dyk <j...@fixieconsulting.com> wrote:
> I'm going through the 99 Haskell problems and am trying to write
> quickCheck properties for each one.
>
> -- 3 (find k"th element of a list)
> element_at xs x = xs !! x
> prop_3a xs x = (x < length xs && x >= 0) ==> element_at xs (x::Int) ==
> (xs !! x::Int)
>
> When I run prop_3a through quickCheck, it gives up, saying that it
> only passed 1 test. ?This makes sense, because the random x is going
> to be larger than the number of elements in the random list in most
> cases.
>
> So what I need to do is write a generator that generates a random list
> with length larger than a random integer, but I'm not sure how to do
> that.
>
> Thanks!
> Joe
>



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

Message: 4
Date: Sat, 8 Oct 2011 06:47:15 +0100
From: Paulo Pocinho <poci...@gmail.com>
Subject: [Haskell-beginners] Real World Haskell: From Portable to
        System.Win32
To: beginners@haskell.org
Message-ID:
        <CAK4i1qQB3iGUG7Ks5M6Xjr3k9LGabUy_OcqAV59BZju4bTP=-a...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hello Haskellers.

I'm having a bit of trouble solving the challenge in chapter 9 of the
book Real World Haskell [1]. I understand the portable code and have
no difficulty with it. More specifically, I want to know how to get a
file's last modified date. Perhaps in understanding this bit I may
also extrapolate to similar parts of System.Win32 more easily.

A simple example using portable code, and also formats the date:

getFileModifiedDate :: FilePath -> IO String
getFileModifiedDate f = do
    m <- getModificationTime f
    c <- toCalendarTime m
    return $ formatCalendarTime undefined "%Y-%m-%d %T" c

However, the exercise is to "port the code from this chapter to your
platform's native API", which in my case is System.Win32. Using the
simple example, I know that I can use getFileTime from System.Win32
[2]:

getFileTime :: HANDLE -> IO (FILETIME, FILETIME, FILETIME)

I suppose that means getFileTime takes a file handle (with type
HANDLE) and returns an IO type with CreationTime LastAccessTime
LastWriteTime [3].

The thing is I don't know how to get a HANDLE type. I understand I can
get a file handle by opening it. I've been trying the following:

openFile :: FilePath -> IOMode -> IO Handle
fh <- openFile "myfile.hs" ReadMode

Right now I cannot use getFileTime on it because this has type Handle:

Couldn't match expected type `HANDLE' with actual type `Handle'
In the first argument of `getFileTime', namely `fh'
In a stmt of an interactive GHCi command: nf <- getFileTime fh

I think I got lost at inspecting the type HANDLE = Ptr ()

If anyone could make a useful example I would appreciate it very much.
Perhaps it's just me going around in circles.


Regards,
P. M. Pocinho

--
[1] 
http://book.realworldhaskell.org/read/io-case-study-a-library-for-searching-the-filesystem.html
[2] 
http://hackage.haskell.org/packages/archive/Win32/2.2.1.0/doc/html/System-Win32-Time.html#t:FILETIME
[3] 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724320%28v=VS.85%29.aspx



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

Message: 5
Date: Sat, 8 Oct 2011 07:09:17 +0100
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] module not found
Cc: beginners@haskell.org
Message-ID:
        <cab2tprdulvwroozshotxsnjsfgfallkabc9b+iwstdcd_qo...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

If you are a beginner, you might want to start with the package
"haskore-vintage" rather than Haskore.

Paul Hudak has written extensive tutorials for the original Haskore
(which is now Haskore-Vintage).

Short - 30 pages
http://haskell.cs.yale.edu/?post_type=publication&p=258

Long - 100 and odd pages, here

http://code.haskell.org/haskore/revised/core/docs/Tutorial.pdf



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

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 40, Issue 9
****************************************

Reply via email to