Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/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: ghc-mod and cabal "could not find module Prelude"
(Norbert Melzer)
2. Re: ghc-mod and cabal "could not find module Prelude"
(Alan Buxton)
3. Re: Structural restrictions in type constructor (Matt Williams)
----------------------------------------------------------------------
Message: 1
Date: Tue, 23 Jun 2015 16:49:16 +0000
From: Norbert Melzer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] ghc-mod and cabal "could not find
module Prelude"
Message-ID:
<ca+bcvstx3eu5oyb4o87+m9srn2ych3u4s_uqgsvo1kmhc1e...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Just add base as dependency in the version constraints matching that base
that is delivered with your version of GHC.
Alan Buxton <[email protected]> schrieb am Di., 23.06.2015, 16:48:
> Hi
>
>
>
> I?ve recently set up a new Haskell working environment on Ubuntu 14.04. I
> installed the Ubuntu packaged version of Haskell platform.
>
>
>
> My problem is that I can?t now get ghc-mod check to work if there is a
> cabal file in the current directory.
>
>
>
>
>
> I am using:
>
> ? ghc-mod 5.2.1.2 compiled by GHC 7.6.3
>
> ? cabal 1.16.0.2
>
>
>
> See below an extract of trying to run ghc-mod check in a directory that
> was empty until I just ran cabal init in it:
>
>
>
> ~/tmp-ghc-mod$ ls
>
> Setup.hs tmp-ghc-mod.cabal
>
> ~/tmp-ghc-mod$ ghc-mod check Setup.hs
>
> Setup.hs:1:1:Could not find module `Prelude'It is a member of the hidden
> package `base'.Perhaps you need to add `base' to the build-depends in your
> .cabal file.It is a member of the hidden package
> `haskell98-2.0.0.2'.Perhaps you need to add `haskell98' to the
> build-depends in your .cabal file.It is a member of the hidden package
> `haskell2010-1.1.1.0'.Perhaps you need to add `haskell2010' to the
> build-depends in your .cabal file.Use -v to see a list of the files
> searched for.
>
> ~/tmp-ghc-mod$ mv tmp-ghc-mod.cabal tmp-ghc-mod.cabal.NOT
>
> ~/tmp-ghc-mod$ ls
>
> dist Setup.hs tmp-ghc-mod.cabal.NOT
>
> ~/tmp-ghc-mod$ ghc-mod check Setup.hs
>
> Setup.hs:2:1:Warning: Top-level binding with no type signature: main :: IO
> ()
>
> ~/tmp-ghc-mod$
>
>
>
> So? ghc-mod behaves as expected when there is no cabal file, but doesn?t
> behave as expected if there is a cabal file.
>
>
>
> My google fu isn?t helping me out on this: the only issues I have seen are
> to do with a change in format of the cabal file in newer versions of cabal.
>
>
>
> Any ideas?
>
>
>
> Thanks
>
> Alan
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150623/5c71826e/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 23 Jun 2015 18:47:05 +0100
From: "Alan Buxton" <[email protected]>
To: "'The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell'" <[email protected]>
Subject: Re: [Haskell-beginners] ghc-mod and cabal "could not find
module Prelude"
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Thanks for the suggestions:
Imants:
There is
library
build-depends: base ==4.6.*
(The cabal file was generated by cabal init and so I would hope it's legit :))
I installed Haskell on my Ubuntu just by doing sudo apt-get install
haskell-platform.
Interestingly, if I do use ghc-mod on a real file with some errors in I get
unnecessarily verbose error messages similar to described here:
http://mail.haskell.org/pipermail/beginners/2015-February/014573.html I wonder
if the issues are related somehow?
Norbert:
I?m not sure what exactly you are suggesting but if I even take the version
constraint out of the cabal file so I have build-depends: base (without any
version specified) then I get the same issue.
From: Beginners [mailto:[email protected]] On Behalf Of Norbert
Melzer
Sent: 23 June 2015 17:49
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level
topics related to Haskell
Subject: Re: [Haskell-beginners] ghc-mod and cabal "could not find module
Prelude"
Just add base as dependency in the version constraints matching that base that
is delivered with your version of GHC.
Alan Buxton <[email protected] <mailto:[email protected]> > schrieb am
Di., 23.06.2015, 16:48:
Hi
I?ve recently set up a new Haskell working environment on Ubuntu 14.04. I
installed the Ubuntu packaged version of Haskell platform.
My problem is that I can?t now get ghc-mod check to work if there is a cabal
file in the current directory.
I am using:
* ghc-mod 5.2.1.2 compiled by GHC 7.6.3
* cabal 1.16.0.2
See below an extract of trying to run ghc-mod check in a directory that was
empty until I just ran cabal init in it:
~/tmp-ghc-mod$ ls
Setup.hs tmp-ghc-mod.cabal
~/tmp-ghc-mod$ ghc-mod check Setup.hs
Setup.hs:1:1:Could not find module `Prelude'It is a member of the hidden
package `base'.Perhaps you need to add `base' to the build-depends in your
.cabal file.It is a member of the hidden package `haskell98-2.0.0.2'.Perhaps
you need to add `haskell98' to the build-depends in your .cabal file.It is a
member of the hidden package `haskell2010-1.1.1.0'.Perhaps you need to add
`haskell2010' to the build-depends in your .cabal file.Use -v to see a list of
the files searched for.
~/tmp-ghc-mod$ mv tmp-ghc-mod.cabal tmp-ghc-mod.cabal.NOT
~/tmp-ghc-mod$ ls
dist Setup.hs tmp-ghc-mod.cabal.NOT
~/tmp-ghc-mod$ ghc-mod check Setup.hs
Setup.hs:2:1:Warning: Top-level binding with no type signature: main :: IO ()
~/tmp-ghc-mod$
So? ghc-mod behaves as expected when there is no cabal file, but doesn?t behave
as expected if there is a cabal file.
My google fu isn?t helping me out on this: the only issues I have seen are to
do with a change in format of the cabal file in newer versions of cabal.
Any ideas?
Thanks
Alan
_______________________________________________
Beginners mailing list
[email protected] <mailto:[email protected]>
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150623/eb0a549b/attachment-0001.html>
------------------------------
Message: 3
Date: Tue, 23 Jun 2015 19:21:03 +0000
From: Matt Williams <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Structural restrictions in type
constructor
Message-ID:
<caftvgqyhsjqwqieofuk5gzl5izbwg8ecobh4jvnng_cmayu...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Dear All,
This has reminded me that perhaps there is an easier way.
I have a Map, whose elements are indexed by a subset of their structure.
I.e. if we have MyType = MyType I T T O E
Where I T O and E are types defined elsewhere.
The Map the indexes elements of type MyType by a pair, (T, T).
I want to be able to index by a pair, independent of order. I had thought
about indexing by a pair of pairs, where the elemtns could be the same but
reversed.
However, the alternative might be to index by a pair, but define that pair
as a type, and alter its Eq => definition:
MyPair = (T, T)
where (t, t') == (t', t) -- I know this syntax is wrong
I could then use that as the index to the Map.
Does that approach make some sense?
Thanks,
Matt
On Tue, 23 Jun 2015 15:33 Kostiantyn Rybnikov <[email protected]> wrote:
> Imants,
>
> You are right. The problem is not in IO here, it's that if you have access
> to data-constructor, you can do things like:
>
> six :: TypeValInt 6
> six = TypeValInt 5
>
> Initially, I was making an assumption that you won't be using a
> data-constructor. After thinking about it a bit, I should note that my code
> isn't much different from just using a "smart constructor" approach, e.g.
> hiding a real MyP constructor, and instead providing a function:
>
> mkMyP (a, b) = MyP (a, b) (b, a)
>
> and exporting only this function. This would make sure all your users only
> create a valid set of data.
>
>
> On Tue, Jun 23, 2015 at 5:05 PM, Imants Cekusins <[email protected]> wrote:
>
>> On 23 June 2015 at 14:54, Kostiantyn Rybnikov <[email protected]> wrote:
>> > Hi Matt. I don't know how bad is this, but here's what I came up with.
>> ...
>>
>> this modified for IO version accepts any input, including that which
>> should have caused error:
>>
>> or did I do something wrong?
>>
>>
>> {-# LANGUAGE DataKinds #-}
>> {-# LANGUAGE KindSignatures #-}
>> {-# LANGUAGE ExistentialQuantification #-}
>> {-# LANGUAGE PolyKinds #-}
>> {-# LANGUAGE StandaloneDeriving #-}
>>
>> module PairsMatchedKR where
>>
>> import GHC.TypeLits
>>
>> data TypeValInt (n::Nat) = TypeValInt Int
>> deriving (Show)
>>
>> one :: TypeValInt 1
>> one = TypeValInt 1
>>
>> two :: TypeValInt 2
>> two = TypeValInt 2
>>
>> data MyP a b = MyP (TypeValInt a, TypeValInt b) (TypeValInt b, TypeValInt
>> a)
>> deriving (Show)
>>
>> main :: IO ()
>> main = do
>> putStrLn "Hello!"
>> x1 <- getLine
>> x2 <- getLine
>> x3 <- getLine
>> x4 <- getLine
>>
>> print (MyP (tvi x1, tvi x2) (tvi x3, tvi x4))
>>
>> class TypeVal (g :: a -> *)
>> instance TypeVal TypeValInt
>>
>> data MyPGen a b = forall g. (TypeVal g, Show (g a), Show (g b))
>> => MyPGen (g a, g b) (g b, g a)
>> deriving instance Show (MyPGen a b)
>>
>>
>> tvi:: String -> TypeValInt (n::Nat)
>> tvi = TypeValInt . read
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150623/f9e5d37f/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 84, Issue 40
*****************************************