Send Beginners mailing list submissions to
        [email protected]

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
        [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:  sorting (Felipe Almeida Lessa)
   2. Re:  Real World Haskell: From Portable to System.Win32
      (Chadda? Fouch?)
   3. Re:  Real World Haskell: From Portable to System.Win32
      (Henk-Jan van Tuyl)
   4.  Fwd: Real World Haskell: From Portable to        System.Win32
      (Paulo M. Pocinho)


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

Message: 1
Date: Sat, 8 Oct 2011 08:56:12 -0300
From: Felipe Almeida Lessa <[email protected]>
Subject: Re: [Haskell-beginners] sorting
To: kolli kolli <[email protected]>
Cc: [email protected]
Message-ID:
        <CANd=OGEBK3auj_t8CCBPThTgZsVjFeGg9aE7rsDHqhAwo=x...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Sat, Oct 8, 2011 at 12:51 AM, kolli kolli <[email protected]> wrote:
> i want the o/p to be ["ala", "jera","zero", "0020", "0030","0022"]

import Data.Char
import Data.List

sortKolli xs =
  let (ns,ys) = partition (all isNumber) xs
  in sort ys ++ ns

-- 
Felipe.



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

Message: 2
Date: Sat, 8 Oct 2011 18:45:43 +0200
From: Chadda? Fouch? <[email protected]>
Subject: Re: [Haskell-beginners] Real World Haskell: From Portable to
        System.Win32
To: Paulo Pocinho <[email protected]>
Cc: [email protected]
Message-ID:
        <canfjzryun8kwdtqhnst-1cjaw50bknik_he8aqfq9njqoqw...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Sat, Oct 8, 2011 at 7:47 AM, Paulo Pocinho <[email protected]> wrote:
>
> 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
>

Yes, the case is significant and that means that Handle and HANDLE
aren't the same, apparently HANDLE is specific to the win32 api (which
I don't know well), a rapid inspection of System.Win32.File seems to
reveal that the only function to get an HANDLE is createFile which has
a ton of parameters you'll need to set carefully to avoid overwriting
your existing file (you should probably define another function with
most of these already fixed for convenience) but should do the trick.

Good luck.
-- 
Jeda?



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

Message: 3
Date: Sat, 08 Oct 2011 21:34:30 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] Real World Haskell: From Portable to
        System.Win32
To: "Paulo Pocinho" <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Sat, 08 Oct 2011 18:45:43 +0200, Chadda? Fouch?  
<[email protected]> wrote:

> On Sat, Oct 8, 2011 at 7:47 AM, Paulo Pocinho <[email protected]> wrote:
>>
>> 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
>>
>
> Yes, the case is significant and that means that Handle and HANDLE
> aren't the same, apparently HANDLE is specific to the win32 api (which
> I don't know well), a rapid inspection of System.Win32.File seems to
> reveal that the only function to get an HANDLE is createFile which has
> a ton of parameters you'll need to set carefully to avoid overwriting
> your existing file (you should probably define another function with
> most of these already fixed for convenience) but should do the trick.

You can use the information about createFile at:
   
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx

Regards,
Henk-Jan van Tuyl


-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--



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

Message: 4
Date: Sun, 9 Oct 2011 02:24:11 +0100
From: "Paulo M. Pocinho" <[email protected]>
Subject: [Haskell-beginners] Fwd: Real World Haskell: From Portable to
        System.Win32
To: [email protected]
Message-ID:
        <cak4i1qtvut233xzpqsso+uuoxwitybdhaxd8t+xnckgx4h+...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

createFile is probably what I should be looking for. As a side note, I
really think this is not a big deal. The portable code is a lot
better. I wonder if that exercise was a pun on working with Haskell
code just to step back into foul territory. And yes, extra careful on
the parameters, or it may end up corrupting other files, launch the
missiles and whatnot. One thing I noticed so far using Haskell,
usually I have to spend more time thinking before hitting the
keyboard. Yet the code is always elegant.

Meanwhile, I've been taking a peek inside System.IO.HVFS from MissingH
[1]. Looks nice.

Thanks for the replies.
Cheers!

--
[1] 
http://hackage.haskell.org/packages/archive/MissingH/1.1.1.0/doc/html/System-IO-HVFS.html#v:vGetModificationTime



On 8 October 2011 20:34, Henk-Jan van Tuyl <[email protected]> wrote:
> On Sat, 08 Oct 2011 18:45:43 +0200, Chadda? Fouch?
> <[email protected]> wrote:
>
>> On Sat, Oct 8, 2011 at 7:47 AM, Paulo Pocinho <[email protected]> wrote:
>>>
>>> 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
>>>
>>
>> Yes, the case is significant and that means that Handle and HANDLE
>> aren't the same, apparently HANDLE is specific to the win32 api (which
>> I don't know well), a rapid inspection of System.Win32.File seems to
>> reveal that the only function to get an HANDLE is createFile which has
>> a ton of parameters you'll need to set carefully to avoid overwriting
>> your existing file (you should probably define another function with
>> most of these already fixed for convenience) but should do the trick.
>
> You can use the information about createFile at:
> ?http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
>
> Regards,
> Henk-Jan van Tuyl
>
>
> --
> http://Van.Tuyl.eu/
> http://members.chello.nl/hjgtuyl/tourdemonad.html
> --
>



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

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

Reply via email to