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. Where does cabal store its junk? (John M. Dlugosz)
2. Re: Where does cabal store its junk? (Karl Voelker)
3. Re: Where does cabal store its junk? (John M. Dlugosz)
4. Error while using indices and elem (Nishant)
5. Re: Error while using indices and elem (Dan Serban)
6. Re: Error while using indices and elem (Chadda? Fouch?)
----------------------------------------------------------------------
Message: 1
Date: Sun, 20 Apr 2014 23:12:15 -0500
From: "John M. Dlugosz" <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Where does cabal store its junk?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
When I use cabal to ?install? a package, where does it end up on my disk? I
can't seem to
find it.
------------------------------
Message: 2
Date: Sun, 20 Apr 2014 21:53:32 -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] Where does cabal store its junk?
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="utf-8"
On Sun, Apr 20, 2014, at 09:12 PM, John M. Dlugosz wrote:
> When I use cabal to ?install? a package, where does it end up on my disk?
> I can't seem to
> find it.
A package can be installed into your user package database or the global
package database, and the locations of both depend on your operating
system (and possibly other factors). If you run "ghc-pkg list", in
addition to listing all your installed packages, it will also show you
the locations of both package databases.
-Karl
------------------------------
Message: 3
Date: Mon, 21 Apr 2014 00:14:20 -0500
From: "John M. Dlugosz" <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Where does cabal store its junk?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 4/20/2014 11:53 PM, Karl Voelker wrote:
> On Sun, Apr 20, 2014, at 09:12 PM, John M. Dlugosz wrote:
>> When I use cabal to ?install? a package, where does it end up on my disk?
>> If you run "ghc-pkg list", in
> addition to listing all your installed packages, it will also show you
> the locations of both package databases.
>
Thanks.
When I looked at the help for cabal, I did not see any option for showing
actual file names.
------------------------------
Message: 4
Date: Mon, 21 Apr 2014 13:36:19 +0530
From: Nishant <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Error while using indices and elem
Message-ID:
<CAEQDmz68od-ODYu8=wktjqhacdlj9e-hkmvtkp9uvxgwco2...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
Do I need to define indices and elem for Graph a w here explicitly ?
import Data.Array
data Graph a w = Array a [(a,w)]
-- array (1,3) [(1,[(2,3),(3,2)])]
--Given a vertex list out adjacents
getAdjVertices :: (Ix a, Eq a) => a -> (Graph a w) -> [a]
getAdjVertices x arr | not (x `elem` (indices arr)) = error "No such Vertex"
| otherwise = extractV (arr ! 2)
where extractV [] = []
extractV (x:xs) = (fst x):extractV (xs)
GHCI gives :
Prelude> :l programs\graph.hs
[1 of 1] Compiling Main ( programs\graph.hs, interpreted )
programs\graph.hs:16:47:
Couldn't match expected type `Array a e0'
with actual type `Graph a w'
In the first argument of `indices', namely `arr'
In the second argument of `elem', namely `(indices arr)'
In the first argument of `not', namely `(x `elem` (indices arr))'
programs\graph.hs:17:46:
Couldn't match expected type `Array Integer [(a, b0)]'
with actual type `Graph a w'
In the first argument of `(!)', namely `arr'
In the first argument of `extractV', namely `(arr ! 2)'
In the expression: extractV (arr ! 2)
Failed, modules loaded: none.
Prelude>
Regards.
Nishant
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140421/e6a0e9a0/attachment-0001.html>
------------------------------
Message: 5
Date: Mon, 21 Apr 2014 11:59:47 +0300
From: Dan Serban <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Error while using indices and elem
Message-ID:
<CAHaPvSd2jJ7cJDH064tf30UoA9-j=pOUhGWPB6wB2L=ofmc...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Hello Nishant,
It's not clear whether you're implementing graph functionality as a
device for learning Haskell, or whether you need it as a kind of a
library to support future programs.
If it's the latter, I want to point you to the Data.Graph module in
the containers package:
http://hackage.haskell.org/package/containers-0.2.0.1/docs/Data-Graph.html
------------------------------
Message: 6
Date: Mon, 21 Apr 2014 11:26:34 +0200
From: Chadda? Fouch? <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Error while using indices and elem
Message-ID:
<canfjzrzwhd_v96v27ck_vsywm9xsj7bx5gttgfpavbskdn6...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Mon, Apr 21, 2014 at 10:06 AM, Nishant <[email protected]> wrote:
>
> Hi,
>
> Do I need to define indices and elem for Graph a w here explicitly ?
>
>
>
> import Data.Array
>
> data Graph a w = Array a [(a,w)]
> -- array (1,3) [(1,[(2,3),(3,2)])]
>
>
>
You probably meant to make "Graph a w" a type synonym but you used "data"
thus it is a type constructor with one data constructor named Array which
takes two parameters : an "a" and a list of pairs of "a" and "w".
You wanted to write :
> type Graph a w = Array a [(a,w)]
which should work better (indices will work on it like on an Array from
Data.Array).
--
Jeda?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140421/5d1a8b65/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 70, Issue 40
*****************************************