Re: [Haskell-cafe] cabal configure cabal build cabal install

2012-11-26 Thread Herbert Valerio Riedel
Brent Yorgey byor...@seas.upenn.edu writes:
 On Sun, Nov 25, 2012 at 06:09:26PM -0500, Albert Y. C. Lai wrote:

 If you begin with cabal configure, the correct idiom is:
 
 cabal configure [flags]
 cabal build
 [cabal haddock, if you want]
 cabal copy
 cabal register

 Even this does not do the same thing as 'cabal install', because it
 does not download and install any dependencies (whereas 'cabal
 install' does).

...but if he prepended a 'cabal install --only-dependencies' to the
invocation sequence it would, wouldn't it?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal configure cabal build cabal install

2012-11-26 Thread Kim-Ee Yeoh
Nice tip, Albert! Good to know! One question I have is, is (runghc
Setup.lhs) equivalent to (cabal) in

runghc Setup.lhs $ [configure, build, install]

?

On Mon, Nov 26, 2012 at 8:08 AM, Brent Yorgey byor...@seas.upenn.eduwrote:

  [cabal haddock, if you want]
  cabal copy
  cabal register

 Even this does not do the same thing as 'cabal install', because it
 does not download and install any dependencies (whereas 'cabal
 install' does).


Brent, that's useful to know too, thanks!

Fwiw, I think Albert had the backdrop of classic GNU autoconf in mind,
predating all that newfangled stuff of downloading (!) dependencies (!!).



-- Kim-Ee



 -Brent

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Equality test between types that returns type-level Bool ?

2012-11-26 Thread Erik Hesselink
If you're up for it, Oleg has a lot of interesting material about this
subject [1].

Regards,

Erik

[1] http://okmij.org/ftp/Haskell/typeEQ.html


On Sun, Nov 25, 2012 at 9:36 AM, Takayuki Muranushi muranu...@gmail.comwrote:

 Is it possible to write

 type family SameType a b :: Bool

 which returns True if a and b are the same type, and False otherwise?

 I encountered this problem when I was practicing promoted lists and
 tuples in ghc-7.6.1. One of my goal for practice is to write more
 modular version of extensible-dimensional calculations, and to
 understand whether ghc-7.6.1 is capable of it.


 http://hackage.haskell.org/packages/archive/dimensional/0.10.2/doc/html/Numeric-Units-Dimensional-Extensible.html

 Some of my attempts:

 https://github.com/nushio3/dimensional-tf/blob/master/attic/list-02.hs
 This fails because :==: is not an equality test between a and b, but
 is a equality test within a (promoted) kind.

 https://github.com/nushio3/dimensional-tf/blob/master/attic/list-03.hs
 This fails because type instance declarations are not read from top to
 bottom. (not like function declarations.)

 https://github.com/nushio3/dimensional-tf/blob/master/attic/map-03.hs
 I could define a lookup using class constraints, but when I use it,
 results in overlapping instances.

 So, will somebody teach me which of the following is correct?

 * We can write a type family SameType a b :: Bool
 * We cannot do that because of theoretical reason (that leads to
 non-termination etc.)
 * We cannot write SameType, but there are ways to write functions like
 'filter' and 'merge' , over type-level lists, without using SameType.

 Always grateful to your help,
 --
 Takayuki MURANUSHI
 The Hakubi Center for Advanced Research, Kyoto University
 http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Observer pattern in haskell FRP

2012-11-26 Thread Nathan Hüsken
Hey,

When writing games in other (imperative) languages, I like to separate
the game logic from the rendering. For this I use something similar to
the observer pattern.

With rendering I mean anything only related to how objects are drawn to
the screen. Animation state for example.

On my journey of exploring game programming with haskell (and FRP), I
wonder what a good way of archiving something similar would be.

If the rendering has no internal state, one can just write a function

draw :: GameLogicState - IO ()

But when the rendering of an object has an internal state (e.g.
animation frame) than this is not possible.

Now I could write a Wire/Signal (whatever FRP implementation I use) that
translates to a RenderingState:

render :: Signal GameLogicState RenderingState
draw :: RenderingState - IO ()

which is fine, except when my game is made of many objects.
Than I need to associate the state of one object in GameLogicState with
a sub-signal in render.
That could be done by giving every object an ID and letting
GameLogicState contain a map from IDs to ObjectLogicState.

I fear that when I really have a lot of objects, assembling and
decomposing the map could become a major bottleneck.

So I am wondering: Is there (or can someone think of) a different
pattern by which this could be archived? Or asked different: How would
you do it?

Thanks!
Nathan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal configure cabal build cabal install

2012-11-26 Thread Albert Y. C. Lai

On 12-11-26 04:34 AM, Kim-Ee Yeoh wrote:

Nice tip, Albert! Good to know! One question I have is, is (runghc
Setup.lhs) equivalent to (cabal) in

runghc Setup.lhs $ [configure, build, install]

?


Setup defaults to --global --prefix=/usr/local
cabal defaults to --user --prefix=$HOME/.cabal

This confuses a lot of people.

FAQ #1: Why does Setup copy abort and say no permission?
Answer: because you haven't escalated privilege for writing to /usr/local

FAQ #2: Why does sudo cabal install register nothing in both the 
global database and my database?
Answer: because --user means not global, and sudo means the user is 
root, not you. Look under /root.


Lastly, there is no Setup install. Use copy and register.


On Mon, Nov 26, 2012 at 8:08 AM, Brent Yorgey byor...@seas.upenn.edu
mailto:byor...@seas.upenn.edu wrote:

  [cabal haddock, if you want]
  cabal copy
  cabal register

Even this does not do the same thing as 'cabal install', because it
does not download and install any dependencies (whereas 'cabal
install' does).


Brent, that's useful to know too, thanks!

Fwiw, I think Albert had the backdrop of classic GNU autoconf in mind,
predating all that newfangled stuff of downloading (!) dependencies (!!).


This is ignorant of a common workflow.

cabal configure is used by a lot of programmers. Today. Why?

Because they use it on their own projects. They use cabal-install as a 
builder, not exactly an installer.


In fact, some of them do:

cabal configure
cabal build
cabal register --inplace

This has no cabal install correspondence.

So you ask, but surely their own projects require some packages from 
hackage?


Yes, surely. But those packages have already been installed in the past, 
once and for all. That is, when the project started, they already did 
cabal install yesod.


This is not so old-school, is it?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Equality test between types that returns type-level Bool ?

2012-11-26 Thread Takayuki Muranushi
Dear Gábor, Erik, and Oleg,

Thank you for your advices. Also what I have wanted, the extensible
dimensional type system, has just been released.

http://hackage.haskell.org/package/unittyped-0.1

Now I have homeworks to test these, thank you!



2012/11/27 Erik Hesselink hessel...@gmail.com

 If you're up for it, Oleg has a lot of interesting material about this
 subject [1].

 Regards,

 Erik

 [1] http://okmij.org/ftp/Haskell/typeEQ.html


 On Sun, Nov 25, 2012 at 9:36 AM, Takayuki Muranushi 
 muranu...@gmail.comwrote:

 Is it possible to write

 type family SameType a b :: Bool

 which returns True if a and b are the same type, and False otherwise?

 I encountered this problem when I was practicing promoted lists and
 tuples in ghc-7.6.1. One of my goal for practice is to write more
 modular version of extensible-dimensional calculations, and to
 understand whether ghc-7.6.1 is capable of it.


 http://hackage.haskell.org/packages/archive/dimensional/0.10.2/doc/html/Numeric-Units-Dimensional-Extensible.html

 Some of my attempts:

 https://github.com/nushio3/dimensional-tf/blob/master/attic/list-02.hs
 This fails because :==: is not an equality test between a and b, but
 is a equality test within a (promoted) kind.

 https://github.com/nushio3/dimensional-tf/blob/master/attic/list-03.hs
 This fails because type instance declarations are not read from top to
 bottom. (not like function declarations.)

 https://github.com/nushio3/dimensional-tf/blob/master/attic/map-03.hs
 I could define a lookup using class constraints, but when I use it,
 results in overlapping instances.

 So, will somebody teach me which of the following is correct?

 * We can write a type family SameType a b :: Bool
 * We cannot do that because of theoretical reason (that leads to
 non-termination etc.)
 * We cannot write SameType, but there are ways to write functions like
 'filter' and 'merge' , over type-level lists, without using SameType.

 Always grateful to your help,
 --
 Takayuki MURANUSHI
 The Hakubi Center for Advanced Research, Kyoto University
 http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe





-- 
Takayuki MURANUSHI
The Hakubi Center for Advanced Research, Kyoto University
http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Observer pattern in haskell FRP

2012-11-26 Thread Тимур Амиров
Not sure, but maybe you can define a Drawable  class with a method in
converting inner state to something draw func could use, so it would be
like this:

draw :: Drawable a = a - IO ()

вторник, 27 ноября 2012 г. пользователь Nathan Hüsken писал:

 Hey,

 When writing games in other (imperative) languages, I like to separate
 the game logic from the rendering. For this I use something similar to
 the observer pattern.

 With rendering I mean anything only related to how objects are drawn to
 the screen. Animation state for example.

 On my journey of exploring game programming with haskell (and FRP), I
 wonder what a good way of archiving something similar would be.

 If the rendering has no internal state, one can just write a function

 draw :: GameLogicState - IO ()

 But when the rendering of an object has an internal state (e.g.
 animation frame) than this is not possible.

 Now I could write a Wire/Signal (whatever FRP implementation I use) that
 translates to a RenderingState:

 render :: Signal GameLogicState RenderingState
 draw :: RenderingState - IO ()

 which is fine, except when my game is made of many objects.
 Than I need to associate the state of one object in GameLogicState with
 a sub-signal in render.
 That could be done by giving every object an ID and letting
 GameLogicState contain a map from IDs to ObjectLogicState.

 I fear that when I really have a lot of objects, assembling and
 decomposing the map could become a major bottleneck.

 So I am wondering: Is there (or can someone think of) a different
 pattern by which this could be archived? Or asked different: How would
 you do it?

 Thanks!
 Nathan

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org javascript:;
 http://www.haskell.org/mailman/listinfo/haskell-cafe



-- 
Best
Timur DeTeam Amirov
Moscow, Russia
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Can a GC delay TCP connection formation?

2012-11-26 Thread Jeff Shaw

Hello,
I've run into an issue that makes me think that when the GHC GC runs 
while a Snap or Warp HTTP server is serving connections, the GC prevents 
or delays TCP connections from forming. My application requires that TCP 
connections form within a few tens of milliseconds. I'm wondering if 
anyone else has run into this issue, and if there are some GC flags that 
could help. I've tried a few, such as -H and -c, and haven't found 
anything to help. I'm using GHC 7.4.1.


Thanks,
Jeff

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal configure cabal build cabal install

2012-11-26 Thread kudah
On Mon, 26 Nov 2012 18:21:33 -0500 Albert Y. C. Lai tre...@vex.net
wrote:

 Lastly, there is no Setup install. Use copy and register.

$ runghc Setup.hs --help
 This Setup program uses the Haskell Cabal Infrastructure.
 See http://www.haskell.org/cabal/ for more information.
 
 Usage: Setup.hs COMMAND [FLAGS]
or: Setup.hs [GLOBAL FLAGS]
 
 Global flags:
  -h --helpShow this help text
  -V --version Print version information
 --numeric-version Print just the version number
 
 Commands:
   configure Prepare to build the package.
   build Make this package ready for installation.
   install   Copy the files into the install locations. Run register.
   copy  Copy the files into the install locations.
   haddock   Generate Haddock HTML documentation.
   clean Clean up after a build.
   sdist Generate a source distribution file (.tar.gz).
   hscolour  Generate HsColour colourised code, in HTML format.
   register  Register this package with the compiler.
   unregisterUnregister this package with the compiler.
   test  Run the test suite, if any (configure with UserHooks).
   bench Run the benchmark, if any (configure with UserHooks).
   help  Help about commands
 
 For more information about a command use
   Setup.hs COMMAND --help
 
 Typical steps for installing Cabal packages:
   Setup.hs configure
   Setup.hs build
   Setup.hs install

On Mon, 26 Nov 2012 18:21:33 -0500 Albert Y. C. Lai tre...@vex.net
wrote:

 cabal configure
 cabal build
 cabal register --inplace

(newer) cabal build registers inplace automatically.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Can a GC delay TCP connection formation?

2012-11-26 Thread Ertugrul Söylemez
Jeff Shaw shawj...@gmail.com wrote:

 I've run into an issue that makes me think that when the GHC GC runs
 while a Snap or Warp HTTP server is serving connections, the GC
 prevents or delays TCP connections from forming. My application
 requires that TCP connections form within a few tens of milliseconds.
 I'm wondering if anyone else has run into this issue, and if there are
 some GC flags that could help. I've tried a few, such as -H and -c,
 and haven't found anything to help. I'm using GHC 7.4.1.

When you compile with -threaded and run on multiple threads, then the
runtime uses parallel GC.  Did you try that?


Greets,
Ertugrul

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.


signature.asc
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal configure cabal build cabal install

2012-11-26 Thread Albert Y. C. Lai

On 12-11-27 01:02 AM, kudah wrote:

On Mon, 26 Nov 2012 18:21:33 -0500 Albert Y. C. Lai tre...@vex.net
wrote:


Lastly, there is no Setup install. Use copy and register.


$ runghc Setup.hs --help

[...]

   install   Copy the files into the install locations. Run register.
   copy  Copy the files into the install locations.


I stand corrected, thank you. But then to complete answering a previous 
question, Setup install does not configure, does not build, and is far 
from cabal install.



(newer) cabal build registers inplace automatically.


I see where you heard this, but it is a misrepresentation from cabal, 
and older cabal has always told a similar misrepresentation.


When cabal build succeeds, it always says:

(older) registering name-version
(newer) In-place registering name-version

That's what it says. But use ghc-pkg and other tests to verify that no 
registration whatsoever has happened.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe