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: Abstracting Data.List (Alexander V Vershilov)
2. Re: Q 2 of 2: GUI and turnkey compiler? (Rustom Mody)
----------------------------------------------------------------------
Message: 1
Date: Sat, 1 Jun 2013 09:25:06 +0400
From: Alexander V Vershilov <[email protected]>
Subject: Re: [Haskell-beginners] Abstracting Data.List
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAO-1Pb6PFR4wLTL-L4OyUC=_q+jedtq0vfyn_7u9-iw2iiu...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
I need to add that it's perfectly valid to define all operation in terms of
Folds and so it's possible to define take, head, and such functions for all
Foldable instances as they have a path to fold over them:
the key idea is to store a state while folding over a structure:
headF :: (Foldable x) => x a -> a
headF = snd . F.foldl (\(s,v) n -> if s then (s,v) else (True,n)) (False,
error "empty")
takeF :: (Foldable x) => Int -> x a -> [a]
takeF c = reverse . snd . F.foldl (\(i,v) n -> if i < c then (i+1,n:v) else
(i,v)) (0,[])
In domain of a lazy languages we will even stop evaluation as soon as we
will get result without additional steps.
On 31 May 2013 18:31, Brandon Allbery <[email protected]> wrote:
> On Fri, May 31, 2013 at 6:16 AM, mukesh tiwari <
> [email protected]> wrote:
>
>> Data.List can be abstracted using Foldable and Traversable but
>> unfortunately I could not find the functions corresponding to head, take.
>>
>
> Those are, again, more general than you want. What is the `head` of a
> HashMap? (Consider that an implementation may choose to randomize the hash
> function to avoid hash collision attacks.) Foldable and Traversable express
> the concept of a collection which has no meaningful concept of an element's
> relative position within the collection. ListLike adds the concept of
> position, thereby admitting an indexing operation (and, by extension,
> `head` which is index 0).
>
> --
> brandon s allbery kf8nh sine nomine
> associates
> [email protected]
> [email protected]
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
--
Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130601/9500b75d/attachment-0001.htm>
------------------------------
Message: 2
Date: Sat, 1 Jun 2013 12:13:54 +0530
From: Rustom Mody <[email protected]>
Subject: Re: [Haskell-beginners] Q 2 of 2: GUI and turnkey compiler?
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAJ+TeoecUo1BF1uKy=ngk82aohowfna7crdjju+z3mec+sy...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Sat, Jun 1, 2013 at 8:14 AM, Brandon Allbery <[email protected]> wrote:
> On Fri, May 31, 2013 at 10:20 PM, Gan Uesli Starling <[email protected]>wrote:
>
>> So, it would be something to allow an author to issue programs which
>> end-users would NOT have to know anything about Haskell itself and would
>> have to, at most, perform a two-step, wholly automatic installation
>> procedure. Short of this, anything I might aspire to give away free to the
>> public en masse, could not conceivably be written in Haskell. In which
>> case, I'll respectfully bow out from endeavoring to learn it myself,
>> however useful it serves for many another purpose.
>
>
> Aside from system libraries, if you don't configure your packages to be
> dynamic GHC works that way. You can also force system libraries if you use
> -static; but note that this also links libc static, which is problematic on
> at least Linux and Solaris. (Usually, the only problematic system library
> is gmp.)
>
> Note that the gmp case is also not significantly different from any random
> Linux program, and you could in fact choose to bundle the appropriate
> libgmp.so.whatever with your program and use a wrapper script which sets
> LD_LIBRARY_PATH (on Linux or Solaris; DYLD_FALLBACK_LIBRARY_PATH on recent
> OS X).
>
> Part of whats throwing you off, I suspect, is that GHC is a native code
> compiler. You might want to look at what it takes for applications for
> other native compilers, such as C and C++, to bundle necessary libraries.
> Perl is an interpreter, and bundling just means including the necessary
> modules in a local library and making use of local::lib, or at worst 'use
> lib'. It's a much simpler situation than native code compilation. Even in
> the case where a .exe is generated for Windows, it's still making use of
> interpreted code; Perl cannot be compiled to native code at all sanely. The
> .exe instead is instead either a bit like a self-unpacking archive, or a
> wrapper which invokes a Perl interpreter on a module tree with various
> environment variables and paths set. JForth, similarly, is based on the JVM
> instead of native code, and it's trivial to bundle up everything needed in
> a jar.
>
> (Apple's done a fair amount of work to make bundling native code easier by
> means of special linker paths in application and framework bundles which
> both the compile-time ld and the runtime dyld can interpret, but this is of
> course not of any use on Windows or Linux.)
>
>
I believe the problem is deeper than just moving executables from here to
there.
Recently after my debian upgrade, cabal broke.
http://groups.google.com/group/haskell-cafe/browse_thread/thread/72ed1e1eca117fef#
Note: I am not saying that something earlier built with cabal broke with
the upgrade.
cabal itself broke and the message implied something to do with libgmp.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130601/38d62d62/attachment-0001.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 60, Issue 2
****************************************