Beginners Digest, Vol 55, Issue 31

2013-01-28 Thread beginners-request
 way of looking at this is that fmap lifts the String-String 
 function stats to (IO String) - (IO String),
 
 Again I cannot see the String inside the IO String, but I can pass it to a 
 function String-IO String, using (=) and putStrLn is such a function, 
 which 
 also does what I need.
 
 I cannot use the same fmap mechanism (fmap putStrLn), because putStrLn is 
 already String - IO String and fmap would lift both sides of -.
 
 I tried to find another way of passing the IO String to putStrLn, but there 
 aren't many options. If I want to use putStrLn, then I need to get the String 
 out of the IO String. AFAICS (=) is the only way to do this (other than do 
 notation). In contrast to fmap,  (=) lifts only the left side.
 
 For the hell of it, I tried to replace putStrLn by a String - Maybe String 
 function. This does not work and it made me realize, that the signature of 
 (=) :: m a - (a- m b) - m b demands that the the Monad m is the same 
 all the way through, and only its type parameter can change.
 
 And the Applicative import is not really needed.
 
 Is this about correct?

That all sounds right to me!

-Brent



--

Message: 3
Date: Mon, 28 Jan 2013 12:01:53 +0530
From: C K Kashyap ckkash...@gmail.com
Subject: Re: [Haskell-beginners] missing ghci, need to install cca
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell beginners@haskell.org
Message-ID:
CAGdT1grWx1SHEmsReGDWF=bF3_sUEPBPZ1upQeRxa=ut6qf...@mail.gmail.com
Content-Type: text/plain; charset=iso-8859-1

Hi Franco,

I've seen this problem when you do not have ~/.cabal/bin in your path. Can
you re-try cabal install Euterpea after adding ~/.cabal/bin in your path.
Also, just check if ~/.cabal/bin has cca executable in there or not.
Regards,
Kashyap


On Sat, Jan 26, 2013 at 5:30 PM, Franco franc...@gmx.com wrote:

  What version of ghc do you have? I thought the 7.6.1 version
  of ghci for armhf did support a working ghci.

 7.4.1 (I am running wheezy/sid).

 7.6.1 is being tested in experimental [1], but debian experimental is
 quite a
 nightmare for me, I plan to stay on stable as soon as wheezy is released.

 [1] http://packages.debian.org/experimental/ghc



 ___
 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/20130128/48a0f9d6/attachment-0001.htm

--

Message: 4
Date: Mon, 28 Jan 2013 09:33:33 +
From: Franco franc...@gmx.com
Subject: [Haskell-beginners]  Re: missing ghci, need to install cca
To: beginners@haskell.org
Message-ID: 20130128093044.GA4680@efikamx
Content-Type: text/plain; charset=us-ascii

 Hi Franco,
 
 I've seen this problem when you do not have ~/.cabal/bin in your path. Can
 you re-try cabal install Euterpea after adding ~/.cabal/bin in your path.
 Also, just check if ~/.cabal/bin has cca executable in there or not.
 Regards,
 Kashyap

I have added the directory to PATH, unfortunately compile fails with the same 
error:

src/Language/Haskell/TH/Instances.hs:175:18:
Template Haskell splice illegal in a stage-1 compiler
  return (LitE (DoublePrimL (toRational d)))
  cabal: Error: some packages failed to install:
  CCA-0.1.3 failed during the building phase. The exception was:
  ExitFailure 1
  demo@efikamx:~/Desktop/media/git/Euterpea$

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/demo/.cabal/bin

there is no cca executable in ~/.cabal/bin

I will try to see if other packages will do. Thanks!

-F





--

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


End of Beginners Digest, Vol 55, Issue 31
*


Beginners Digest, Vol 55, Issue 32

2013-01-28 Thread beginners-request
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:  How to unnest do (Daniel Trstenjak)
   2.  reorganizing lists (Bryce Verdier)
   3. Re:  reorganizing lists (Ozgur Akgun)
   4. Re:  reorganizing lists (divyanshu ranjan)
   5. Re:  reorganizing lists (Bryce Verdier)
   6. Re:  reorganizing lists (Brent Yorgey)
   7. Re:  reorganizing lists (Martin Drautzburg)
   8.  How to interact with a process (Martin Drautzburg)


--

Message: 1
Date: Mon, 28 Jan 2013 15:27:44 +0100
From: Daniel Trstenjak daniel.trsten...@gmail.com
Subject: Re: [Haskell-beginners] How to unnest do
To: beginners@haskell.org
Message-ID: 20130128142744.GA16791@machine
Content-Type: text/plain; charset=us-ascii


Hi Emmanuel,

On Sun, Jan 27, 2013 at 09:46:30PM +0100, Emmanuel Touzery wrote:
 Thank you. I thought it might be, but it isn't exactly intuitive for me at
 this point. I'll read some more about that monad.

Sometimes it's hard to tell if Haskell is the most beautiful language
or the most abstract nonsense. ;)


Let's look at the Monad instance for the function (r - a):

instance Monad ((-) r) where
   -- return :: a - (r - a)
   return a = \_ - a

   -- (=) :: (r - a) - (a - r - b) - (r - b)
   left = right = \r - right (left r) r 


'return' creates a function ignoring its argument and just returning 'a'.

'=' creates a function with the argument 'r'. The function 'left' is
called with 'r' and the function 'right' is called with the result of
'left' and 'r'.


Now let's look at the 'sequence' function:

sequence ms = foldr k (return []) ms
   where
  k m ms = do
 x  - m
 xs - ms
 return (x : xs)


It's easier to see what happens if we rewrite 'k':

k m ms = m = (\x - (ms = \xs - return (x : xs)))


We saw that '=' creates a function with one argument, that argument
is the String containing the file contents, 'x' is the return value
of one sequenced function which is combined (:) with the previous
ones.

At the end we have the function (String - [String]).


Greetings,
Daniel



--

Message: 2
Date: Mon, 28 Jan 2013 10:37:53 -0800
From: Bryce Verdier bryceverd...@gmail.com
Subject: [Haskell-beginners] reorganizing lists
To: beginners@haskell.org
Message-ID: 5106c581.1050...@gmail.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi All,

At the moment I have a list of lists. The inner list is a coordinate, 
like (x,y) but is [x,y] instead. What I would like to do is group all 
the x's into one list, and the y's into another. I know I can do this 
with calling 2 maps on the container, but I would also like to do this 
in one iteration.

Does anyone have any ideas?

Thanks in advance,
Bryce





--

Message: 3
Date: Mon, 28 Jan 2013 18:42:58 +
From: Ozgur Akgun ozgurak...@gmail.com
Subject: Re: [Haskell-beginners] reorganizing lists
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell beginners@haskell.org
Message-ID:
calzazparl9ei5ce_ettvn+2xi9urlwuchmyp11brlza6gvj...@mail.gmail.com
Content-Type: text/plain; charset=utf-8

Hi,

On 28 January 2013 18:37, Bryce Verdier bryceverd...@gmail.com wrote:

 I know I can do this with calling 2 maps on the container, but I would
 also like to do this in one iteration.


As a learning experience, may I suggest you post the code you would have
written with two maps? Then we can try and improve on that to have only one
map.

Best,


-- 
Ozgur Akgun
-- next part --
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20130128/f234f5e8/attachment-0001.htm

--

Message: 4
Date: Tue, 29 Jan 2013 00:14:18 +0530
From: divyanshu ranjan idivyanshu.ran...@gmail.com
Subject: Re: [Haskell-beginners] reorganizing lists
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell beginners@haskell.org
Message-ID:
CAL9hw24QC5hJZcPoJdXv=fklaqadu664_u3ey_przf95meb...@mail.gmail.com
Content-Type: text/plain; charset=utf-8

Hi,
  You can use foldl (\(fx, fy) [x,y] - (x:fx, y:fy)) ([],[])

Thanks
Divyanshu Ranjan

On Tue, Jan 29, 2013 at 12:07 AM, Bryce Verdier bryceverd...@gmail.comwrote:

 Hi All,

 At the moment I have a list of lists. The inner list is a coordinate, like
 (x,y) but is [x,y] instead. What I would like to do is group all the x's
 into one list