Re: [Haskell-cafe] Harder Question - Chapter 4 - 4.12 - haskell the craft of functional programming - Second Edition

2013-07-09 Thread Anton Nikishaev
Manoel Menezes writes: > Hi everybody! > > I am trying to solve the question for a long time: > > [4.12 Harder] Find out the maximum number of pieces we can get by > making a given number of flat (that is planar) cuts through a solid > block. It is not the same answer as we calculated for straigh

Re: [Haskell-cafe] llvm on macos

2013-08-15 Thread Anton Nikishaev
Ozgur Akgun writes: > Hi. > > On 10 August 2013 18:20, Brandon Allbery wrote: > > There may be some support for requesting specific versions from > Homebrew. > > > Try `brew versions llvm`. Then, you'll need to run the git checkout > command in `brew --prefix` directory. > Or brew tap h

Re: [Haskell-cafe] Alternative name for return

2013-08-15 Thread Anton Nikishaev
Simon Peyton-Jones writes: > | Indeed, I wished the 0-ary case would be more alike to the unary > | and binary case, cf. > | > | return f0 > | f1 <$> a1 > | f2 <$> a1 <*> a2 > | > | What is needed is a nice syntax for "idiom brackets". > > Indeed. I'm quite open to adding idio

Re: [Haskell-cafe] inv f g = f . g . f

2013-08-17 Thread Anton Nikishaev
Christopher Done writes: > Anyone ever needed this? Me and John Wiegley were discussing a decent > name for it, John suggested inv as in involution. E.g. > > inv reverse (take 10) > inv reverse (dropWhile isDigit) > trim = inv reverse (dropWhile isSpace) . dropWhile isSpace > > That seems to be t

Re: [Haskell-cafe] Using Quick Check generators for getting arbitrary value streams

2013-10-10 Thread Anton Nikishaev
Luke Evans writes: > I was hoping I could use Arbitrary instances to generate streams of > values for test data. It looks like you're not 'supposed' to be > trying this, other than for the specific purpose of then testing some > properties on these streams within Quick Check itself. > > I'm look

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-25 Thread Anton Nikishaev
Arlen Cuss writes: >> import Data.Either >> type (:|:) a b = Either a b >> (???) = either >> >> foo :: (Int :|: Bool :|: String :|: Double) -> Int >> foo = >> \ i -> i + 7 ??? >> \ b -> if b then 1 else 0 ??? >> \ s -> length s ??? >> \ d -> floor d > > INFIX TYPE OPERATOR

Re: [Haskell-cafe] How to get a file path to the program invoked?

2011-12-01 Thread Anton Nikishaev
dokondr writes: > Hi, > When my program starts it needs to know a complete path to the directory from > which it was invoked. > In terms of standard shell (sh) I need the Haskell function that will do > equivalent to: > > #!/bin/sh > path=$(dirname $0) > > How to get this path in Haskell? > > get

Re: [Haskell-cafe] How to get a file path to the program invoked?

2011-12-01 Thread Anton Nikishaev
Anton Nikishaev writes: > dokondr writes: > >> Hi, When my program starts it needs to know a complete path to the >> directory from which it was invoked. In terms of standard shell (sh) >> I need the Haskell function that will do equivalent to: >> >> #!/bi