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: How best to do this? (Brent Yorgey)
2. Re: question about shared data types (Federico Mastellone)
3. Broken packages after upgrading to Ubuntu 13.04 (Johannes Engels)
4. Re: Broken packages after upgrading to Ubuntu 13.04
(Daniel Fischer)
----------------------------------------------------------------------
Message: 1
Date: Mon, 29 Apr 2013 17:54:17 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] How best to do this?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Oh, yes, I suppose it could.
In any case, I am still in favor of the existing semantics -- it is
simple and consistent (and sometimes even useful). "Do what I
mean"-style semantics with special cases end up generating more pain
than they solve.
-Brent
On Mon, Apr 29, 2013 at 02:29:43PM -0400, David McBride wrote:
> Couldn't it just use fromEnum and compare the integers you get and
> figure out which is bigger?
>
> On Mon, Apr 29, 2013 at 2:17 PM, Brent Yorgey <[email protected]> wrote:
> > But then \x y -> [x .. y] would have to have the type
> >
> > (Ord a, Enum a) => [a]
> >
> > whereas now it just has the Enum constraint. Either that or else the
> > notation would work differently for literals vs. expressions but that
> > would be just awful.
> >
> > -Brent
> >
> > On Mon, Apr 29, 2013 at 11:57:38AM -0400, David McBride wrote:
> >> I think it is because that syntax is desugared directly to enumFromTo
> >> x y and enumFromTo 3 0 is []. Random things would probably blow up if
> >> you make that function work in reverse. But I would love it if ghc
> >> just checked whether the first was lower than the second and swapped
> >> them as a convenience.
> >>
> >> On Mon, Apr 29, 2013 at 11:44 AM, emacstheviking <[email protected]> wrote:
> >> > ROFLCOPTER indeed Batman!
> >> >
> >> > I had no idea of that... I just *assumed* (usual rules apply I guess)
> >> > that
> >> > [3..0] was the "opposite" of [0..3] but sure enough a wuicj ghci session
> >> > reveals the bitter truth!
> >> >
> >> > Thanks again... i can see that it's not just me that is too lazy at
> >> > times. I
> >> > guess writing [3,2..0] will do for now but is that a bug or is there some
> >> > other reasoning behind it?
> >> >
> >> > We live and learn, well, I live anyway...
> >> >
> >> > :)
> >> >
> >> >
> >> >
> >> > On 29 April 2013 16:37, David McBride <[email protected]> wrote:
> >> >>
> >> >> One other gotcha. I don't know why it is this way, but [3..0]
> >> >> evaluates to []. I have no idea why reverse notation is not allowed.
> >> >> But you can just manually reverse it or you can go [3,2..0].
> >> >>
> >> >> On Mon, Apr 29, 2013 at 11:26 AM, emacstheviking <[email protected]>
> >> >> wrote:
> >> >> > damn that lazy evaluation! LMAO ...a good point brent and yuo have no
> >> >> > doubt
> >> >> > saved me hours of head scratching this evening when I try out the "new
> >> >> > improved software". Oh dear oh dear oh dear...
> >> >> >
> >> >> > doOption dev (Forward n) = do
> >> >> > putStrLn $ "> STEP FORWARD " ++ (show n)
> >> >> > stepBits dev ioPORTA [3..0]
> >> >> >
> >> >> >
> >> >> > doOption dev (Backward n) = do
> >> >> > putStrLn $ "> STEP BACKWARD " ++ (show n)
> >> >> > stepBits dev ioPORTA [0..3]
> >> >> >
> >> >> > stepBits dev port = mapM_ stepIt
> >> >> > where stepIt bit = mapM_ (\s -> HW.setPortBit dev port bit s >>
> >> >> > stepDelay)
> >> >> > [0,1]
> >> >> >
> >> >> > I now have the above as my current "final" implementation... hopefully
> >> >> > that
> >> >> > *does* do what I think it does because mapM_ is driving it and will
> >> >> > cause
> >> >> > evaluation of the actions?
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > On 29 April 2013 15:56, Brent Yorgey <[email protected]> wrote:
> >> >> >>
> >> >> >> On Mon, Apr 29, 2013 at 02:59:29PM +0100, emacstheviking wrote:
> >> >> >> > I have built a library for using the Hexwax expandIO-USB chip and I
> >> >> >> > have
> >> >> >> > now got some code to drive a stepper motor:
> >> >> >> >
> >> >> >> > doOption :: HWHandle -> Flag -> IO ()
> >> >> >> > doOption dev (Backward n) = do
> >> >> >> > putStrLn $ "> STEP BACKWARD " ++ (show n)
> >> >> >> > let x = [ stepBit b | b <- [3..0]]
> >> >> >> > return ()
> >> >> >> > where
> >> >> >> > stepBit p b = setBit p b 0 >> setBit p b 1
> >> >> >> > where setBit p b s = HW.setPortBit dev p b s >> stepDelay
> >> >> >>
> >> >> >> The other posted solutions are good, but I also want to make a very
> >> >> >> important comment about the above code: it does not actually step any
> >> >> >> bits! All it does is print some stuff. x is simply a name for a
> >> >> >> list
> >> >> >> of IO actions; it is never used so it just gets garbage collected and
> >> >> >> the IO actions are never run.
> >> >> >>
> >> >> >> -Brent
> >> >> >>
> >> >> >> _______________________________________________
> >> >> >> Beginners mailing list
> >> >> >> [email protected]
> >> >> >> http://www.haskell.org/mailman/listinfo/beginners
> >> >> >
> >> >> >
> >> >> >
> >> >> > _______________________________________________
> >> >> > Beginners mailing list
> >> >> > [email protected]
> >> >> > http://www.haskell.org/mailman/listinfo/beginners
> >> >> >
> >> >>
> >> >> _______________________________________________
> >> >> Beginners mailing list
> >> >> [email protected]
> >> >> http://www.haskell.org/mailman/listinfo/beginners
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > Beginners mailing list
> >> > [email protected]
> >> > http://www.haskell.org/mailman/listinfo/beginners
> >> >
> >>
> >> _______________________________________________
> >> Beginners mailing list
> >> [email protected]
> >> http://www.haskell.org/mailman/listinfo/beginners
> >
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 2
Date: Tue, 30 Apr 2013 00:52:31 -0300
From: Federico Mastellone <[email protected]>
Subject: Re: [Haskell-beginners] question about shared data types
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
Common practice are the Common.hs, Types.hs or Internal.hs modules with the
internally shared code of your package.
Just import them on modules Aaa and Bbb and reexport what is needed by the
users of those modules so they can write only one import declaration.
Look at
http://hackage.haskell.org/packages/archive/binary/0.7.0.1/doc/html/Data-Binary-Builder-Internal.html
and
http://hackage.haskell.org/packages/archive/blaze-builder/0.3.1.1/doc/html/Blaze-ByteString-Builder.html
(the Builder type is in Blaze.ByteString.Builder.Internal.Types and is used
everywhere).
On Apr 29, 2013, at 10:44 AM, Brent Yorgey <[email protected]> wrote:
>
> example, you will often see a module named something like
> 'Foo.Bar.Types' which contains declarations of common types which are
> used in many other modules.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130430/4bfa7c05/attachment-0001.htm>
------------------------------
Message: 3
Date: Tue, 30 Apr 2013 10:05:28 +0200
From: Johannes Engels <[email protected]>
Subject: [Haskell-beginners] Broken packages after upgrading to Ubuntu
13.04
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Hello, using the OS-specific Haskell packages of the Ubuntu distribution,
I have some cabal packages installed in addition, e.g. hmatrix etc.
After an upgrade to Ubuntu 13.04 most of these cabal packages are broken
because some dependencies do not exist anymore or have been upgraded also,
respectively. With ghc-pkg check I get messages like
There are problems in package hmatrix-0.14.0.1:
dependency "array-0.4.0.0-0b32f6f98c0297dbb0e5cfc0087bd1f0" doesn't exist
dependency "base-4.5.0.0-c8e7184681d410015e93df85fc49e9dd" doesn't exist
....
Actually now array-0.4.0.1 is installed etc.
What is the recommended way to repair this? Should I do a --reinstall of
the cabal packages (which should mostly also work with the upgraded
dependencies)? Any hint would be welcome!
Best regards
Johannes Engels
------------------------------
Message: 4
Date: Tue, 30 Apr 2013 10:35:07 +0200
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Broken packages after upgrading to
Ubuntu 13.04
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
On Tuesday 30 April 2013, 10:05:28, Johannes Engels wrote:
> Hello, using the OS-specific Haskell packages of the Ubuntu distribution,
> I have some cabal packages installed in addition, e.g. hmatrix etc.
> After an upgrade to Ubuntu 13.04 most of these cabal packages are broken
> because some dependencies do not exist anymore or have been upgraded also,
> respectively. With ghc-pkg check I get messages like
>
> There are problems in package hmatrix-0.14.0.1:
> dependency "array-0.4.0.0-0b32f6f98c0297dbb0e5cfc0087bd1f0" doesn't exist
> dependency "base-4.5.0.0-c8e7184681d410015e93df85fc49e9dd" doesn't exist
> ....
>
> Actually now array-0.4.0.1 is installed etc.
> What is the recommended way to repair this? Should I do a --reinstall of
> the cabal packages (which should mostly also work with the upgraded
> dependencies)? Any hint would be welcome!
You have a different version of array, so you most likely have a different
version of GHC. That means you have to rebuild your cabal packages.
Check with the --dry-run flag first,
$ cabal install world --dry-run
whether cabal finds a consistent install plan.
But that ghc-pkg check searches the package-db of the previous version
irritates me. It should see that that is from an older version and ignore it.
> Best regards
> Johannes Engels
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 58, Issue 51
*****************************************