<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.lang.haskell.beginners">
    <title>gmane.comp.lang.haskell.beginners</title>
    <link>http://blog.gmane.org/gmane.comp.lang.haskell.beginners</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9959"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9958"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9957"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9956"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9955"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9954"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9953"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9952"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9950"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9949"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9948"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9947"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9946"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9945"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9944"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9943"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9942"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9941"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9940"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9939"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9959">
    <title>Re: Help!,was Re: Trouble with "import qualified"</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9959</link>
    <description>&lt;pre&gt;
Try starting from a fresh file? I just tried the simplest thing I could
think of to reproduce this, but it worked:

jumba ~ $ echo "import qualified Data.Map as Map" &amp;gt;&amp;gt; test.hs
jumba ~ $ echo "main = print \"Hello, World\"" &amp;gt;&amp;gt; test.hs
jumba ~ $ runhaskell test.hs
"Hello, World"
jumba ~ $ ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude&amp;gt; :l test.hs
[1 of 1] Compiling Main             ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main&amp;gt; main
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
"Hello, World"
*Main&amp;gt;

&lt;/pre&gt;</description>
    <dc:creator>Michael Orlitzky</dc:creator>
    <dc:date>2012-05-24T16:49:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9958">
    <title>Help!, was Re: Trouble with "import qualified"</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9958</link>
    <description>&lt;pre&gt;Hi.  I've had this up for over a week, and haven't received any 
response.  Any help would be greatly appreciated.

On 5/16/12 10:04 PM, Dudley Brooks wrote:


&lt;/pre&gt;</description>
    <dc:creator>Dudley Brooks</dc:creator>
    <dc:date>2012-05-24T16:34:22</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9957">
    <title>Re: Traverse tree with computing current level using Foldable instance.</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9957</link>
    <description>&lt;pre&gt;
By the way, for this sort of pattern where you change the state for
some subcomputation and then restore it after the subcomputation
returns, it can be much nicer to use the Reader monad with the 'local'
function instead of the State monad.  That might actually go a long
way towards making the monadic version nicer to read. =)

-Brent

&lt;/pre&gt;</description>
    <dc:creator>Brent Yorgey</dc:creator>
    <dc:date>2012-05-24T12:54:23</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9956">
    <title>Re: Traverse tree with computing current level using Foldable instance.</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9956</link>
    <description>&lt;pre&gt;
Hi, Chaddaï. Thanks for the clarification!

Now i think i get it. Here is three my solutions. First one is (as you 
suggest)
without monads:

 &amp;gt; import Data.Monoid
 &amp;gt; import Control.Monad.State
 &amp;gt;
 &amp;gt; data Tape a             =  Tape a [Tape a]
 &amp;gt;
 &amp;gt; foldTape :: (a -&amp;gt; [b] -&amp;gt; b) -&amp;gt; Tape a -&amp;gt; b
 &amp;gt; foldTape f (Tape name ts)
 &amp;gt;                         = f name (map (foldTape f) ts)
 &amp;gt;
 &amp;gt; foldTapeD :: (Monoid m) =&amp;gt; (Int -&amp;gt; a -&amp;gt; m) -&amp;gt; Tape a -&amp;gt; m
 &amp;gt; foldTapeD f t           = (foldTape (go f) t) 0
 &amp;gt;   where
 &amp;gt;     go :: (Monoid m) =&amp;gt; (Int -&amp;gt; a -&amp;gt; m) -&amp;gt; a -&amp;gt; [(Int -&amp;gt; m)] -&amp;gt; (Int 
-&amp;gt; m)
 &amp;gt;     go f name xs        = \cs -&amp;gt;
 &amp;gt;                           foldr (mappend . ($ (cs + 1))) (f cs name) xs

second one with monadic go function:

 &amp;gt; foldTapeD1 :: (Monoid m) =&amp;gt; (Int -&amp;gt; a -&amp;gt; m) -&amp;gt; Tape a -&amp;gt; m
 &amp;gt; foldTapeD1 f t          = fst $ runState (foldTape (go f) t) 0
 &amp;gt;   where
 &amp;gt;     go :: (Monoid m) =&amp;gt; (Int -&amp;gt; a -&amp;gt; m) -&amp;gt; a -&amp;gt; [State Int m] -&amp;gt; 
State Int m
 &amp;gt;     go f name xs        = do
 &amp;gt;                             cs &amp;lt;- get
 &amp;gt;                             put (cs + 1)
 &amp;gt;                             foldr (go' (cs + 1)) (return (f cs name)) xs
 &amp;gt;     go' :: (Monoid m) =&amp;gt; Int -&amp;gt; State Int m -&amp;gt; State Int m -&amp;gt; State Int m
 &amp;gt;     go' cs mx mz        = do
 &amp;gt;                             x &amp;lt;- mx
 &amp;gt;                             put cs
 &amp;gt;                             z &amp;lt;- mz
 &amp;gt;                             put cs
 &amp;gt;                             return (x `mappend` z)

and the last one with monadic go function and monadic user-defined folding
function:

 &amp;gt; foldTapeD2 :: (Monoid m) =&amp;gt; (a -&amp;gt; State Int m) -&amp;gt; Tape a -&amp;gt; m
 &amp;gt; foldTapeD2 f t          = fst $ runState (foldTape (go f) t) 0
 &amp;gt;   where
 &amp;gt;     go :: (Monoid m) =&amp;gt;
 &amp;gt;           (a -&amp;gt; State Int m) -&amp;gt; a -&amp;gt; [State Int m] -&amp;gt; State Int m
 &amp;gt;     go f name xs        = do
 &amp;gt;                             cs &amp;lt;- get
 &amp;gt;                             z &amp;lt;- f name
 &amp;gt;                             put (cs + 1)
 &amp;gt;                             foldr (go' (cs + 1)) (return z) xs
 &amp;gt;     go' :: (Monoid m) =&amp;gt; Int -&amp;gt; State Int m -&amp;gt; State Int m -&amp;gt; State Int m
 &amp;gt;     go' cs mx mz        = do
 &amp;gt;                             x &amp;lt;- mx
 &amp;gt;                             put cs
 &amp;gt;                             z &amp;lt;- mz
 &amp;gt;                             put cs
 &amp;gt;                             return (x `mappend` z)

and here is test functions:

 &amp;gt; testTape                :: Tape String
 &amp;gt; testTape                =  Tape "A" [ Tape "B"  [ Tape "C" []
 &amp;gt;                                                 , Tape "F" [Tape "G"
 &amp;gt;                                                               [Tape 
"H" []]]
 &amp;gt;                                                 , Tape "E" []
 &amp;gt;                                                 ]
 &amp;gt;                                     , Tape "D"  [ Tape "I" []]
 &amp;gt;                                     ]
 &amp;gt; testFoldTapeD :: ((Int -&amp;gt; a -&amp;gt; [a]) -&amp;gt; Tape a -&amp;gt; [a]) -&amp;gt;
 &amp;gt;                  Int -&amp;gt; Tape a -&amp;gt; [a]
 &amp;gt; testFoldTapeD ftD i t   = ftD (\cs x -&amp;gt; if cs == i then [x] else []) t
 &amp;gt; testFoldTapeD1 :: ((a -&amp;gt; State Int [a]) -&amp;gt; Tape a -&amp;gt; [a]) -&amp;gt;
 &amp;gt;                   Int -&amp;gt; Tape a -&amp;gt; [a]
 &amp;gt; testFoldTapeD1 ftD i t
 &amp;gt;     = ftD (\x -&amp;gt; get &amp;gt;&amp;gt;= \cs -&amp;gt; if cs == i then return [x] else 
return []) t

Is my answer correct? :)

And at the end it seems, that first (non-monadic) version is much 
simpler and
clearer, than all other. So.. should i use monads here?
Earlier i think, that it's better to use them, but now i doubt.

--
     Dmitriy Matrosov

_______________________________________________
Beginners mailing list
Beginners&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/beginners
&lt;/pre&gt;</description>
    <dc:creator>Dmitriy Matrosov</dc:creator>
    <dc:date>2012-05-24T11:09:24</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9955">
    <title>Re: [Haskell-cafe] Most C++ compilers will not optimize x^2.0 as x*x but instead will do an expensive ...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9955</link>
    <description>&lt;pre&gt;
I don't think anyone's disputing that, it's just that the form of many
of his/her messages + lack of threading means that they'll get ignored
(because they don't make sense without context... which is unavailable)
or that KC will get killfiled (after seeing enough "meaningless"
messages from a person this tends to happen). Which would be a shame.

Regards,


&lt;/pre&gt;</description>
    <dc:creator>Bardur Arantsson</dc:creator>
    <dc:date>2012-05-24T03:33:38</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9954">
    <title>Re: [Haskell-cafe] Most C++ compilers will not optimize x^2.0 as x*x but instead will do an expensive ...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9954</link>
    <description>&lt;pre&gt;Just to play devil's advocate, if you look back at the list, KC has
written a lot of helpful and informative messages in the past.

Tom

On 5/23/12, Bardur Arantsson &amp;lt;spam&amp;lt; at &amp;gt;scientician.net&amp;gt; wrote:

&lt;/pre&gt;</description>
    <dc:creator>Tom Murphy</dc:creator>
    <dc:date>2012-05-24T03:24:04</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9953">
    <title>Re: [Haskell-cafe] Most C++ compilers will not optimize x^2.0 as x*x but instead will do an expensive ...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9953</link>
    <description>&lt;pre&gt;
Right. I was actually just about to respond to (only) KC in person, but
perhaps unwisely, decided to "hijack" your response to add a little
explanation for everyone.

You are of course right that not quoting context and just randomly
spewing out small bits of text is not really suitable for a mailing list.


&lt;/pre&gt;</description>
    <dc:creator>Bardur Arantsson</dc:creator>
    <dc:date>2012-05-24T02:39:34</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9952">
    <title>Re: [Haskell-cafe] Most C++ compilers will not optimize x^2.0 as x*x but instead will do an expensive ...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9952</link>
    <description>&lt;pre&gt;

That, however, ignores the rest of it; the lack of references in this case
forms a pattern with the other things I noted, in that a conversation is
apparently being held in the form of single observations emitted at the
point of observation instead of being collected and presented *as* a
conversation.

&lt;/pre&gt;</description>
    <dc:creator>Brandon Allbery</dc:creator>
    <dc:date>2012-05-24T02:31:32</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9950">
    <title>Re: Most C++ compilers will not optimize x^2.0 as x*x but instead will do an expensive ...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9950</link>
    <description>&lt;pre&gt;

Is it me or is this style of message — content broken between subject and
body, no reference information tying it to the presumed topic (or possibly
a /non sequitur/) — better suited to Twitter than a mailing list?

&lt;/pre&gt;</description>
    <dc:creator>Brandon Allbery</dc:creator>
    <dc:date>2012-05-24T02:13:33</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9949">
    <title>Most C++ compilers will not optimize x^2.0 as x*x but instead will do an expensive ...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9949</link>
    <description>&lt;pre&gt;exponentiation and logarithm.

So, I believe this C++ versus Haskell versus (your language of choice) is a
Penn &amp;amp; Teller misdirection.

Whereas, another level of indirection solves everything.

&lt;/pre&gt;</description>
    <dc:creator>KC</dc:creator>
    <dc:date>2012-05-24T01:47:31</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9948">
    <title>Re: Traverse tree with computing current level using Foldable instance.</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9948</link>
    <description>&lt;pre&gt;
So, you wrote it correctly :


This appears desperate since there's no mention of Int anywhere in
this function and the function applied stay the same whatever the
level : the initially given f parameter.
But there's a trick to this, we'll have to treat some of our type
variable like functions, here only b can vary freely (a is imposed by
the Tape a inputted), so let's see what it looks like if we make it a
functional type (with Int parameter):


much more promising wouldn't you say ? The solution now looks like that :


I let you write your solution (if you didn't find before tomorrow
evening, I'll give you the answer).

You can then call foldTapeD thus :


(much nicer than your initial solution, is it not ?)
&lt;/pre&gt;</description>
    <dc:creator>Chaddaï Fouché</dc:creator>
    <dc:date>2012-05-23T16:48:27</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9947">
    <title>Re: Traverse tree with computing current level using Foldable instance.</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9947</link>
    <description>&lt;pre&gt;
Hi, Brent, and thanks for the answer! I've tried to define foldTape and then
foldMapS2 using it, i've tried.. ugh, i think everything, with fold and with
map, but i still can't.

Well, this is the whole story. I repeat part of the previous message, 
since i
refer to it later. Here is my tree definition, test tree and test function:

import Data.Monoid
import Control.Monad.State

type TpName             =  String
type TpLevel            =  Int
type TpState a          =  State TpLevel a
data Tape a             =  Tape a [Tape a]

&lt;/pre&gt;</description>
    <dc:creator>Dmitriy Matrosov</dc:creator>
    <dc:date>2012-05-23T10:51:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9946">
    <title>Found quote: "One of the ineradicable illusions about C++ is that the compiler should be able to see through ...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9946</link>
    <description>&lt;pre&gt;all the abstractions and obfuscations an “advanced” C++ program contains.
First and foremost, C++ should be seen as a language that enables complexity
management. The features one has grown fond of in this concept, like
operator
overloading, object orientation, automatic construction/destruction, etc.,
are however
mostly unsuitable for efficient low-level code."

From "Introduction to High Performance Computing for Scientists and
Engineers" CRC Press, 2011.

So if one avoids such C++ complexity management features and a Haskell
compiler can see through most of the complexity management features of
Haskell; they should be comparable. :)


Casey

&lt;/pre&gt;</description>
    <dc:creator>KC</dc:creator>
    <dc:date>2012-05-23T06:48:21</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9945">
    <title>Re: From some "High-Performance Computing" book; "It is hard to eradicate from C++'ers the need for objects, classes, etc. ..."</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9945</link>
    <description>&lt;pre&gt;Imho, the quote is slightly wrong.

A more correct one would be "It is hard to erradicate from *object-oriented
programmers* the need for objects, classes, etc...".

See, those who came to C++ with a background from C (me included) don't
have a lot of trouble filtering through useful abstractions and over
engineering. C++ is a multi-paradigm programming language after all, and
does not enforce an object-oriented architecture.

The problem is that much more of the C++ developers these days come with a
background of (almost) pure OO languages, looking for more performance.
Specially Java.

If you code C++ like you code in Java, you will have all the pitfalls of
over-engineering over you.

I haven't learned much of haskell myself, I have more of a curiosity than a
need to learn it. But just trying to solve some simple exercises and
forcing yourself to break your code into simpler, smaller function flows,
has already done marvels to me.

One of these days I started a new, private project in C++. I started
thinking with classes and suddenly got overwhelmed with all the flows and
small objects that had to be created and such. Then I stopped and thought
"What's the simplest way of doing it?" and then I remembered Haskell. God,
it's so much simpler working just with STL containers and plain old
functions!

Sooner or later I had to create a type myself, but after all it seemed just
right and just contributed to the application design, not getting in the
way of the code logic. This is the "right" way of programming: use the
right tools for the job.

Does it make sense to have a class to encapsulate something that could be
represented by a simple string object? Then create this class. Otherwise,
stick with the what you already have available and use functions.

Homero Cardoso de Almeida

--------------------------------------------------------------------------------
    B.el Ciência da Computação - UNIFEI 2006
--------------------------------------------------------------------------------

"Yeah. I can fly."
       -- Iron Man
+ homerocda&amp;lt; at &amp;gt;gmail.com
+ (19) 8139-3700


On Tue, May 22, 2012 at 4:04 PM, KC &amp;lt;kc1956&amp;lt; at &amp;gt;gmail.com&amp;gt; wrote:

&lt;/pre&gt;</description>
    <dc:creator>Homero Cardoso de Almeida</dc:creator>
    <dc:date>2012-05-22T19:20:14</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9944">
    <title>From some "High-Performance Computing" book; "It is hard to eradicate from C++'ers the need for objects, classes, etc. ..."</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9944</link>
    <description>&lt;pre&gt;"For high-performance computing you want to avoid such software engineering
abstractions as classes, objects, etc...."

Therefore, I would say, since Haskell makes possible many fine-levels of
abstraction, if the compiler can strip most of these away, then it would
come close to the speed of C (i.e. C++ without most of the software
engineering abstractions).


Still, I remember that quote that, "Another level of indirection solves
everything."

Or

If you're Penn &amp;amp; Teller, "Another level of misdirection solves everything."

Casey

&lt;/pre&gt;</description>
    <dc:creator>KC</dc:creator>
    <dc:date>2012-05-22T19:04:38</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9943">
    <title>Re: Missing some functions in Hoogle</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9943</link>
    <description>&lt;pre&gt;(...)

Hi.

Hoogle [1] can search by type as well as by name. This currently only
works for standard Haskell libraries.
Hayhoo [2] is a string-based search only but also covers hackage [3].

After testing Hoogle cabal package [4], it can either generate
databases for the current system or fetch the database from the
internet. However, database search only covered standard libraries.
Having search by type in hackage would be great though.

Hope this helps.

--
1. http://www.haskell.org/hoogle/
2. http://holumbus.fh-wedel.de/hayoo/hayoo.html
3. http://hackage.haskell.org/packages/hackage.html
4. http://hackage.haskell.org/package/hoogle

Regards,
Paulo

&lt;/pre&gt;</description>
    <dc:creator>Paulo Pocinho</dc:creator>
    <dc:date>2012-05-22T14:09:48</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9942">
    <title>Re: Traverse tree with computing current level using Foldable instance.</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9942</link>
    <description>&lt;pre&gt;
You cannot.  Foldable is not general enough; it does not allow you to
define folds which can observe the *structure* of the container being
folded over (such as the level in a tree, the number of children of a
given node, etc.).  It corresponds to simply "flattening" the
structure into a list of elements, turning each of them into a value
of some monoid, and then applying mconcat.

However, you should be able to define a general fold for Tape, with
type

  foldTape :: (a -&amp;gt; [b] -&amp;gt; b) -&amp;gt; Tape a -&amp;gt; b

and then define foldMapS2 in terms of foldTape.

-Brent

&lt;/pre&gt;</description>
    <dc:creator>Brent Yorgey</dc:creator>
    <dc:date>2012-05-22T02:18:34</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9941">
    <title>Re: [x] and (x:_) for lists -- did you everthink that odd?</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9941</link>
    <description>&lt;pre&gt;

While a discussion is going on off the list, I would like to publicly
apologize for my rough tone.  I felt offended by the last remark.

Of course I'm not taking back my statement, I just feel like it doesn't
really apply to Anthony's original post.

For questions like this I would recommend writing it in such a way that
the intention is clear.  It was somehow blurred by the rhetorical style.

I also hope that people aren't offended by my mail signature, which
indeed is a bit offensive. =)


Greets,
Ertugrul

&lt;/pre&gt;</description>
    <dc:creator>Ertugrul Söylemez</dc:creator>
    <dc:date>2012-05-22T01:04:30</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9940">
    <title>Re: [x] and (x:_) for lists -- did youeverthink that odd?</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9940</link>
    <description>&lt;pre&gt;

I tend to use bracket notation for fixed-length list patterns.



Yes.  It's quite seldom that I use bracket notation, though.  That's
simply because it's seldom that I pattern-match against fixed-length
lists.


Greets,
Ertugrul
&lt;/pre&gt;</description>
    <dc:creator>Ertugrul Söylemez</dc:creator>
    <dc:date>2012-05-22T01:02:10</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9939">
    <title>Re: [x] and (x:_) for lists -- did you everthink that odd?</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9939</link>
    <description>&lt;pre&gt;
[snip ..]

So Ertugrul, as an experienced Haskeller which of these do you put in your 
code for a singleton list (whether appearing in a pattern or as an expression):
    [x]
    (x: [])

Or perhaps you mix them, depending on whether you want to be more suggestive 
of an empty list [] or an unknown-length list (x: xs)?

[.. snippety-snip]

AntC



_______________________________________________
Beginners mailing list
Beginners&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/beginners
&lt;/pre&gt;</description>
    <dc:creator>AntC</dc:creator>
    <dc:date>2012-05-22T00:49:40</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9938">
    <title>Re: [x] and (x:_) for lists -- did you ever think that odd?</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.haskell.beginners/9938</link>
    <description>&lt;pre&gt;
cons-like notation.

Good point Brandon, I should have asked what background and expectations 
people were coming from. From ALGOL, square brackets mean arrays, which are 
close-ish to lists(?)

(For Lispers: does it seem odd using colon? Does it seem odd that dot is 
function composition, not cons pairing?)

I was more getting at the oddness (or perhaps not) of having two different 
notations.


No, I wasn't anywhere near making a "suggestion" or "proposal". Just asking 
for people's impressions.


FWIW, the double-dot notation is not currently valid in a pattern.

I wanted to show something with square brackets. And to my mind, the double-
dot could be taken as an unknown-length tail of the list, like an ellipsis. 
But others (it seems) think of it as enumFrom.

AntC



&lt;/pre&gt;</description>
    <dc:creator>AntC</dc:creator>
    <dc:date>2012-05-22T00:36:47</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.lang.haskell.beginners">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.haskell.beginners</link>
  </textinput>
</rdf:RDF>

