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:  Shorten this code (Henk-Jan van Tuyl)
   2. Re:  Pipe and typeclasses (Emmanuel Surleau)
   3.  Module name from a function name? (Jong-won Choi)
   4. Re:  Module name from a function name? (Karl Voelker)
   5. Re:  Module name from a function name? (Jong-won Choi)


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

Message: 1
Date: Wed, 24 Jul 2013 15:18:34 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
To: [email protected], "Nadav Chernin" <[email protected]>
Subject: Re: [Haskell-beginners] Shorten this code
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Tue, 23 Jul 2013 12:41:32 +0200, Nadav Chernin <[email protected]>  
wrote:

> Hi, all
> Below is my solution to SPOJ->Polybius
> square<http://www.spoj.com/problems/POLYBIUS>
>
> Please try to shorten it:
>
> *import Data.Maybe*
> *d=[1..5]*
> *f s=unwords$map(\c->fromJust$lookup c(('
> ',""):('J',"24"):zip(['A'..'I']++['K'..'Z'])[show(x+10*y)|y<-d,x<-d]))s*
> *main=getLine>>(interact$unlines.map f.lines)*

If you remove the unnecessary spaces from the following code, it is  
shorter than yours:

d="12345"
f s = unwords $ map (\c -> let (Just x) = lookup c ((' ',"") : ('J',"24")  
: zip (['A'..'I'] ++ ['K'..'Z']) [y : [x] | y <- d, x <- d]) in x) s
main = getLine >> (interact $ unlines . map f . lines)

Note, that this is not a real solution to the problem, as you don't do  
anything with the first input.

Regards,
Henk-Jan van Tuyl


-- 
Folding@home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/


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



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

Message: 2
Date: Wed, 24 Jul 2013 21:12:23 +0200
From: Emmanuel Surleau <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Pipe and typeclasses
Message-ID:
        <CADd2AG4Xo7cWTE9KqRu7uzsLeYu7szddy=jninyplabjtpr...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Thanks! Actually, I read about them some time ago (last year?) but prompty
forgot again, it looks like.

On Tue, Jul 23, 2013 at 9:56 PM, Karol Samborski <[email protected]>wrote:

> 2013/7/23 Emmanuel Surleau <[email protected]>
>
>> Hello,
>>
>> I have seen from time to time the pipe symbol in type signatures, like so:
>>
>>   class Monad m => MonadReader r m | m -> r where
>>
>> How should I interpret that ? Or more to the point, how does the compiler
>> interpret it?
>>
>
> Hi Emmanuel!
>
> The pipe symbol is for a functional dependency:
> http://www.haskell.org/haskellwiki/Functional_dependencies
>
>
Thanks Karol! I actually read about the concept some months ago, but
apparently forgot about it again.

Cheers,

Emm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130724/ac3bb947/attachment-0001.html>

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

Message: 3
Date: Thu, 25 Jul 2013 13:27:59 +1000
From: Jong-won Choi <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Module name from a function name?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=EUC-KR

Hi,

I am self-teaching Haskell and also try to fix a slightly broken Emacs
mode for Haskell.

I'd like to browse Haskell documentation from Emacs - C-c C-d on a
function name, say.

Current Emacs Lisp Haskell mode implementation uses return value of
':info', for example, GHC.List for length (the function name I want to
browse).
Unfortunately, this does not work because Glasgow Haskell's HTML doc
uses module name Data.List(i.e. Data-List.html) instead of GHC.List.

I'd like to get 'Data.List' from 'length'. How can I do this?

For example, if it is Common Lisp, this can be achieved by:
(symbol-package 'length)

One more thing. I think :info command is only for GHC. Is there any
portable ways which will work on other implementations as well?

Thanks!

- Jong-won Choi



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

Message: 4
Date: Wed, 24 Jul 2013 21:49:09 -0700
From: Karl Voelker <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Module name from a function name?
Message-ID:
        <CAFfow0xiS=-B=70bkqxujxebt_fnhqdn4n6zs_qvhgmsx4-...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

The problem is that length is defined in GHC.List and simple re-exported by
Data.List (and by Prelude).

You could try tying into a command-line installation of Hoogle. A quick
search for "length" on the Hoogle website shows that it finds it in both
Prelude and Data.List.

-Karl


On Wed, Jul 24, 2013 at 8:27 PM, Jong-won Choi <[email protected]>wrote:

> Hi,
>
> I am self-teaching Haskell and also try to fix a slightly broken Emacs
> mode for Haskell.
>
> I'd like to browse Haskell documentation from Emacs - C-c C-d on a
> function name, say.
>
> Current Emacs Lisp Haskell mode implementation uses return value of
> ':info', for example, GHC.List for length (the function name I want to
> browse).
> Unfortunately, this does not work because Glasgow Haskell's HTML doc
> uses module name Data.List(i.e. Data-List.html) instead of GHC.List.
>
> I'd like to get 'Data.List' from 'length'. How can I do this?
>
> For example, if it is Common Lisp, this can be achieved by:
> (symbol-package 'length)
>
> One more thing. I think :info command is only for GHC. Is there any
> portable ways which will work on other implementations as well?
>
> Thanks!
>
> - Jong-won Choi
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130724/e259b6ae/attachment-0001.html>

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

Message: 5
Date: Thu, 25 Jul 2013 14:12:16 +1000
From: Jong-won Choi <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Module name from a function name?
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

Hi Karl,

Then let me change my question; how can I get all the module names which 
(re-)export a given function name?

I can make my Emacs Lisp code work if I can get a list of all such 
module names.

Thanks!

- Jong-won

2013-07-25 ?? 2:49, Karl Voelker ? ?:
> The problem is that length is defined in GHC.List and simple 
> re-exported by Data.List (and by Prelude).
>
> You could try tying into a command-line installation of Hoogle. A 
> quick search for "length" on the Hoogle website shows that it finds it 
> in both Prelude and Data.List.
>
> -Karl
>
>
> On Wed, Jul 24, 2013 at 8:27 PM, Jong-won Choi 
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Hi,
>
>     I am self-teaching Haskell and also try to fix a slightly broken Emacs
>     mode for Haskell.
>
>     I'd like to browse Haskell documentation from Emacs - C-c C-d on a
>     function name, say.
>
>     Current Emacs Lisp Haskell mode implementation uses return value of
>     ':info', for example, GHC.List for length (the function name I want to
>     browse).
>     Unfortunately, this does not work because Glasgow Haskell's HTML doc
>     uses module name Data.List(i.e. Data-List.html) instead of GHC.List.
>
>     I'd like to get 'Data.List' from 'length'. How can I do this?
>
>     For example, if it is Common Lisp, this can be achieved by:
>     (symbol-package 'length)
>
>     One more thing. I think :info command is only for GHC. Is there any
>     portable ways which will work on other implementations as well?
>
>     Thanks!
>
>     - Jong-won Choi
>
>     _______________________________________________
>     Beginners mailing list
>     [email protected] <mailto:[email protected]>
>     http://www.haskell.org/mailman/listinfo/beginners
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130725/e6f1edaa/attachment-0001.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 61, Issue 29
*****************************************

Reply via email to