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:  replacing fold with scan! (Mateusz Kowalczyk)
   2. Re:  Problem installing EclipseFp in Eclipse (Robert Weisser)


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

Message: 1
Date: Fri, 02 May 2014 10:06:16 +0200
From: Mateusz Kowalczyk <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] replacing fold with scan!
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

On 05/01/2014 04:42 AM, raffa f wrote:
> hi everyone! here's my new problem. i wrote my version of filter:
> 
> filter' :: (a -> Bool) -> [a] -> [a]
> filter' f = foldr (\x acc -> if f x then x:acc else acc) []
> 
> and it works! however, i wanted to use scan too. so i just replaced foldr
> with scanr, to see what would happen:
> 
> filter'' :: (a -> Bool) -> [a] -> [a]
> filter'' f = scanr (\x acc -> if f x then x:acc else acc) []
> 
> but that doesn't work! ghci gives me this:
> 
> folds.hs:15:59:
>     Couldn't match expected type `a' with actual type `[a0]'
>       `a' is a rigid type variable bound by
>           the type signature for filter'' :: (a -> Bool) -> [a] -> [a]
>           at folds.hs:14:13
>     In the second argument of `scanr', namely `[]'
>     In the expression:
>       scanr (\ x acc -> if f x then x : acc else acc) []
>     In an equation for filter'':
>         filter'' f = scanr (\ x acc -> if f x then x : acc else acc) []
> Failed, modules loaded: none.
> 
> the problem seems to be with the start value of [], it seems? i don't
> understand, i thought scan and fold worked pretty much the same. i learned
> about these functions today, so i'm still trying to wrap my head around
> them...
> 
> thank you!
> 
> 
> 
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
> 

Simply look at the types:

foldr :: (a -> b -> b) -> b -> [a] -> b
Prelude> :t scanr
scanr :: (a -> b -> b) -> b -> [a] -> [b]

You should now be able to see why your filter'' can't have the same type
signature as your filter'.

You could just ask what GHCi thinks about your function by removing the
signature:

Prelude> :t \f -> scanr (\x acc -> if f x then x:acc else acc) []
\f -> scanr (\x acc -> if f x then x:acc else acc) []
  :: (a -> Bool) -> [a] -> [[a]]

So you're saying that your function takes (a -> Bool) and [a] and
returns [a] but that's not the case: it takes (a -> Bool) and [a] and
returns [[a]].

-- 
Mateusz K.


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

Message: 2
Date: Fri, 02 May 2014 16:14:12 +0200
From: "Robert Weisser" <[email protected]>
To: beginners <[email protected]>
Subject: Re: [Haskell-beginners] Problem installing EclipseFp in
        Eclipse
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

Hi Vlatko,

Thanks again for your help. I'm actually using a Mac, which should be almost 
exactly like linux.

Robert
----- Original Message -----
From: Vlatko Basic
Sent: 05/01/14 01:23 PM
To: Robert Weisser, The Haskell-Beginners Mailing List - Discussion of 
primarily beginner-level topics related to Haskell
Subject: Re: [Haskell-beginners] Problem installing EclipseFp in Eclipse

Hi Robert,

The two solutions below are exclusive. Either first or second.

When you install ghc, it creates two directories in your $HOME. Those are 
.cabal and .ghc.
In those directories cabal installs packages.

cabal-dev and SourceGraph are executable programs only and you do not need 
their source files, just binary file.

So, the proposed solution creates those executable programs, but without 
disturbing packages you already have installed.

Let me know if you need further help.

I'm assuming you're on Linux. But the solution for Windows should be similar, 
but not sure.

vlatko

-------- Original Message --------
Subject: Re: [Haskell-beginners] Problem installing EclipseFp in Eclipse
From: Robert Weisser  [email protected] 
To:  [email protected] , The Haskell-Beginners Mailing List - Discussion 
of primarily beginner-level topics related to Haskell  [email protected] 
Date: 01.05.2014 16:44

Thanks, Vlatko. I'm not sure I understand everything you said, but I'll give it 
a try. 

Robert 
----- Original Message -----
From: Vlatko Basic
Sent: 05/01/14 03:59 AM
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level 
topics related to Haskell
Subject: Re: [Haskell-beginners] Problem installing EclipseFp in Eclipse

Hi Robert,

Current version supports only cabal-dev for sandboxing. New version that is 
about to come out will support cabal for sandboxing as well.

The problem is that installed ghc depends on cabal version being shipped with.
And it looks like it'll stay like that for a while, and until it is solved, 
you'll depend on cabal being shipped with ghc.

The problematic packages are bins only, so you can
 - build them sandboxed and
 move the bins to .cabal/bin or
 - move/rename your .cabal and .ghc,
 cabal update,
 build cabal-dev and sourcegraph as usual,
 copy the bins to moved/renamed .cabal/bin,
 delete newly created .cabal and .ghc,
 move/rename back your .cabal and .ghc

You can go with 3. also, but for a bit larger project you'll run into 
cabal-hell, so better to use it.


It is quite comfortable to work in eclipseFP, so I think it is worth some 
initial troubles. :-)


Best regards,

vlatko

-------- Original Message --------
Subject: Re: [Haskell-beginners] Problem installing EclipseFp in Eclipse
From: Robert Weisser  [email protected] 
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level 
topics related to Haskell  [email protected] 
Date: 01.05.2014 05:17

Thanks. That's great info. 
----- Original Message -----
From: Norbert Melzer
Sent: 04/30/14 07:19 PM
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level 
topics related to Haskell
Subject: Re: [Haskell-beginners] Problem installing EclipseFp in Eclipse

Omit cabal-dev it is not maintained anymore and most of its functionality is 
part of cabal already (cabal sandbox)

Am 01.05.2014 00:18 schrieb "Robert Weisser" < [email protected] >: 
I decided to try out Eclipse with the EclipseFP plug-in for Haskell.
I downloaded Eclipse, and then started to install EclipseFP. At
some point, I got a screen which said that I needed to install
buildwrapper and scion-browser. It offered to install both
of them, and optionally install hoogle, hlint, stylish-haskell,
SourceGraph, and cabal-dev. The option to install the additional
items was pre-checked. I left it checked. The installation of
buildwrapper, etc. took a long time. It seemed to be going well
until I saw the messages below, which say that installing SourceGraph
will likely break several other packages, most of which were part
of the EclipseFP installation.

I am not a complete novice with Haskell but I am a complete novice
with Cabal. I'm not sure what to do. Here are some options I have
considered:

1. Use --force-reinstalls and hope for the best.

2. Try to resolve the problem with Cabal, although I don't know to
do this.

3. Use EclipseFP without SourceGraph and cabal-dev.

4. Use EclipseFP without SourceGraph, but install cabal-dev using
cabal on the command line.

5. Forget about Eclipse altogether, and go back to using vim.

Any advice would be appreciated.

By the way, I am using Haskell Platform 7.6.3.

Here are the messages I saw in the Eclipse console window:

<terminated> Installing executable SourceGraph

Resolving dependencies...
In order, the following would be installed:
asn1-types-0.2.3 (new package)
asn1-encoding-0.8.1.3 (new package)
asn1-parse-0.8.1 (new package)
bktrees-0.3.1 (new package)
byteable-0.1.1 (new package)
cereal-0.4.0.1 (new package)
colour-2.3.3 (new package)
cpphs-1.18.2 (new version)
crypto-pubkey-types-0.4.2.2 (new package)
cryptohash-0.11.4 (new package)
digest-0.0.1.2 (new package)
dlist-0.5 (new version)
aeson-0.7.0.3 (reinstall) changes: dlist-0.7.0.1 -> 0.5
data-default-instances-dlist-0.0.1 (reinstall) changes: dlist-0.7.0.1 -> 0.5
data-default-0.5.3 (reinstall)
cookie-0.4.1.1 (new package)
haskell-src-exts-1.13.5 (new version)
hslua-0.3.12 (new package)
mime-types-0.1.0.4 (new package)
multiset-0.2.2 (new package)
pandoc-types-1.12.3.2 (new package)
pem-0.2.2 (new package)
polyparse-1.8 (new version)
publicsuffixlist-0.1 (new package)
http-client-0.3.2 (new package)
regex-pcre-builtin-0.94.4.8.8.34 tel:0.94.4.8.8.34  (new package)
highlighting-kate-0.5.6.1 (new package)
resourcet-0.4.10.2 (new version)
securemem-0.1.3 (new package)
crypto-cipher-types-0.0.9 (new package)
cipher-aes-0.2.7 (new package)
cipher-rc4-0.1.4 (new package)
crypto-random-0.0.7 (new package)
cprng-aes-0.5.2 (new package)
crypto-numbers-0.2.3 (new package)
crypto-pubkey-0.2.4 (new package)
socks-0.5.4 (new package)
temporary-1.1.2.5 (new package)
text-stream-decode-0.1.0.5 (new package)
conduit-1.0.17.1 (new version)
http-client-conduit-0.2.0.1 (new package)
wl-pprint-text-1.1.0.2 (new package)
graphviz-2999.16.0.0 (new package)
x509-1.4.11 (new package)
x509-store-1.4.4 (new package)
x509-system-1.4.5 (new package)
x509-validation-1.5.0 (new package)
tls-1.2.6 (new package)
connection-0.2.1 (new package)
http-client-tls-0.2.1.1 (new package)
http-conduit-2.0.0.10 (new package)
xml-1.3.13 (new package)
texmath-0.6.6.1 (new package)
yaml-0.8.8.2 (reinstall) changes: conduit-1.1.1 -> 1.0.17.1, resourcet-1.1.2
-> 0.4.10.2
zip-archive-0.2.2.1 (new package)
pandoc-1.12.3.3 (new package)
Graphalyze-0.14.0.2 (new package)
SourceGraph-0.7.0.5 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
stylish-haskell-0.5.10.0
scion-browser-0.3.1
persistent-template-1.3.1.3
persistent-sqlite-1.3.0.5
persistent-1.3.0.6
buildwrapper-0.8.0
dynamic-cabal-0.3.1
Use --force-reinstalls if you want to install anyway.
_______________________________________________
Beginners mailing list
 [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/20140502/ec5db4c4/attachment.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 71, Issue 5
****************************************

Reply via email to