Re: [Haskell-cafe] typeclass to select a list element

2013-10-12 Thread adam vogt
Hi Paolino, There are some functions similar to that in HList (Data.HList.HArray). Check the repo http://code.haskell.org/HList for a version that uses more type families / gadts. Maybe there is a way to take advantage of the fact that you've labelled the elements of the list, but extract isn't t

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

2013-10-08 Thread adam vogt
Hi Luke, It seems like you missed this module: http://hackage.haskell.org/package/QuickCheck-2.6/docs/Test-QuickCheck-Gen.html Adam On Mon, Oct 7, 2013 at 7:21 PM, Luke Evans wrote: > I was hoping I could use Arbitrary instances to generate streams of values > for test data. > It looks like yo

Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-06 Thread adam vogt
On Sun, Oct 6, 2013 at 6:54 PM, Tillmann Rendel wrote: > Hi, > > > Ryan Newton wrote: >> >> It is very hard for me to >> see why people should be able to make their own Generic instances (that >> might lie about the structure of the type), in Safe-Haskell. > > > I guess that lying Generics instanc

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-28 Thread adam vogt
On Sat, Sep 28, 2013 at 1:09 PM, Ryan Newton wrote: > Hi all, > > We all know and love Data.Foldable and are familiar with left folds and > right folds. But what you want in a parallel program is a balanced fold > over a tree. Fortunately, many of our datatypes (Sets, Maps) actually ARE > balanc

Re: [Haskell-cafe] type-level integers, type-level operators, and most specific overlapping instance

2013-09-22 Thread adam vogt
On Sun, Sep 22, 2013 at 11:07 AM, TP wrote: > My misunderstanding came from a confusion between a "context" and a > "constraint". The context is what is before the =>, and the constraint is > what is after, i.e. the main part of the instance declaration. Hi TP, I think context and constraint mea

Re: [Haskell-cafe] type-level integers, type-level operators, and most specific overlapping instance

2013-09-21 Thread adam vogt
Hi TP, You can add another instance to cover the case that everything is zero. Then you don't need the :<. Also it's convenient to arrange for the a,b,c to be the argument to Tensor, as given below: class Multiplication a b c | a b -> c where (*) :: Tensor a -> Tensor b -> Tensor c instance

Re: [Haskell-cafe] Template Haskell and Unit

2013-08-29 Thread adam vogt
Hi Jose and Richard, haskell-src-meta has Language.Haskell.Meta.Utils.normalizeT which can help with making code "treat the two constructs equivalently", though I imagine using th-desugar instead will make that process harder to mess up. Adam On Thu, Aug 29, 2013 at 10:13 AM, Richard Eisenberg

Re: [Haskell-cafe] Template Haskell: let statement in a splice put in the "main = do" part of a program?

2013-08-25 Thread adam vogt
On Sat, Aug 24, 2013 at 11:00 AM, TP wrote: > that has type Stmt, in an ExpQ that seems to be the only thing that we can > put in a splice. I have found that it can only be done by doE (or DoE) and > compE (or CompE) according to > > http://www.haskell.org/ghc/docs/latest/html/libraries/template-h

Re: [Haskell-cafe] What am I missing? Cycle in type synonym declarations

2013-08-20 Thread adam vogt
On Tue, Aug 20, 2013 at 5:00 PM, David Fox wrote: > This file gives me the error "Cycle in type synonym declarations" Can > anyone tell me why? I'm just trying to write a function to create a > type that is a FooT with the type parameter fixed. > > {-# LANGUAGE TemplateHaskell #-} > import Langu

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread adam vogt
On Mon, Aug 19, 2013 at 5:40 AM, AntC wrote: ... > Would double-parens be too wild an idea?: > > ... ((CustId 47)) `extend` (CustName "Fred", Gender Male) > > f ((CustId x)) = ... > > instance C ((CustId Int)) ... > > We'd have to avoid the double parens as in: > > ((meth obj) (dou

[Haskell-cafe] ANN: Rlang-QQ-0.0.0.0

2013-08-15 Thread adam vogt
t is made to translate anything on the R side back to haskell. Regards, Adam Vogt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-20 Thread adam vogt
On Sat, Jul 20, 2013 at 12:14 AM, Michael Orlitzky wrote: > For posterity, I report failure =) Hi Michael, It's fairly straightforward to generate the new data with template haskell [1], and on the same page, section "10.7 'generic' zipWith" is likely to be similar to your merging code. [1]

Re: [Haskell-cafe] Dynamic and equality

2013-07-20 Thread adam vogt
On Sat, Jul 20, 2013 at 12:31 AM, Carter Schonwald wrote: > the tricky part then is to add support for other types. > > another approach to existentially package type classes with the data type! > > eg > data HasEq = forall a . HasEq ( Eq a => a) > or its siblinng > data HasEq a = Haseq (Eq a =>

Re: [Haskell-cafe] Dynamic and equality

2013-07-19 Thread adam vogt
On Fri, Jul 19, 2013 at 5:19 AM, Jose A. Lopes wrote: > Hello, > > How to define equality for Data.Dynamic ? Hi Jose, You could try casting the values to different types that do have an (==). You can treat the case where you have the types matching, but didn't list that type beforehand different

Re: [Haskell-cafe] How to use Template Haskell based on code that generated by another Template?

2013-07-03 Thread adam vogt
On Wed, Jul 3, 2013 at 2:25 AM, Magicloud Magiclouds wrote: > Then I got > Illegal variable name: `UserPassword' > When splicing a TH declaration: Hi Magicloud, GHC seems to be trying to tell you that variables are lowercase in haskell. Since you don't have code, I'm guessing your error is f

Re: [Haskell-cafe] some questions about Template Haskell

2013-07-01 Thread adam vogt
On Mon, Jul 1, 2013 at 5:42 PM, TP wrote: > So what is the difference between lift and [||]? > Although I feel stupid, I cannot lie and claim I have understood. Hi TP, Sometimes [| |] does need to call lift. If for some reason the original lift wasn't exported, you could define: myLift x = [| x

Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-04 Thread adam vogt
On Sun, Jun 2, 2013 at 10:19 PM, Ting Lei wrote: > Thanks for your answers so far. > > It seems that the laziness of String or [char] is the problem. > > My question boils then down to this. There are plenty of Haskell FFI > examples where simple things like sin/cos in can be imported into > Hask

Re: [Haskell-cafe] Projects using Shake

2013-05-30 Thread adam vogt
On Thu, May 30, 2013 at 8:17 PM, Frerich Raabe wrote: > Hi, > > I'm considering to convert one of my projects to Shake; everything I've seen > so far seemed really interesting! > > However, before I start, I'd like to see how other people structure their > Shake-based build systems. I tried to f

Re: [Haskell-cafe] Diving into the records swamp (possible GSoC project)

2013-04-26 Thread adam vogt
Hi Aleksandar, This library for extensible records does use -XDataKinds: . It doesn't have as many definitions as HList, but that might be because more recent extensions are more powerful. Many other libraries are listed

[Haskell-cafe] ANN: ipopt-hs 0.0.0.0

2013-04-22 Thread adam vogt
teCallback are not included Cheers, Adam Vogt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Type checking the content of a string

2013-02-22 Thread adam vogt
On Fri, Feb 22, 2013 at 12:44 PM, Corentin Dupont wrote: > Hi all, > I have a program able to read another program as a string, and interpret it > (using Hint). > I'd like to make unit tests, so I have a file "Test.hs" containing a serie > of test programs as strings. > However, how could I be sur

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-31 Thread adam vogt
On Sun, Dec 30, 2012 at 10:00 PM, Brandon Allbery wrote: > On Sun, Dec 30, 2012 at 8:42 PM, Dan Burton > wrote: >>> >>> [featureX] is usually too powerful, it surely would be abused >>> extensively, which would make developer's life a nightmare, unless there is >>> only one developer and whole de

Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread adam vogt
There is no check that all arguments of LongDec are the same type (in this case a specific instance of Typeable): you'd only be able to get Nothing out of mkLongDec was defined as: data LongDec a = LongDec a Int a a a Char Regards, Adam Vogt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Template Haskell Splicing

2012-12-15 Thread adam vogt
On Sat, Dec 15, 2012 at 9:24 AM, satvik chauhan wrote: > Yeah, that is the problem. I have a function inside which I need to generate > some declarations using TH. I can not generate these at the top level as > these generations depend on the function's parameters which are local to the > function

Re: [Haskell-cafe] Variable-arity zipWith (re)invented.

2012-12-11 Thread adam vogt
On Mon, Dec 10, 2012 at 7:23 PM, Takayuki Muranushi wrote: > Repeated thanks to you, Adam! Your code is brilliantly simple. > > Sadly, I cannot reproduce the behaviors in your comments on my ghci > (7.6.1) . > Can we guess why? The version of packages we are using? > > Mines are here. > > htt

Re: [Haskell-cafe] Variable-arity zipWith (re)invented.

2012-12-10 Thread adam vogt
On Sat, Dec 8, 2012 at 10:27 AM, Takayuki Muranushi wrote: > Continued discussion from > > https://groups.google.com/d/topic/haskell-cafe/-e-xaCEbd-w/discussion > https://groups.google.com/d/topic/haskell-cafe/kM_-NvXAcx8/discussion > > Thank you for all the answeres and thinkings; > > > Here's zi

Re: [Haskell-cafe] Understanding GHC's instance inference.

2012-12-05 Thread adam vogt
On Wed, Dec 5, 2012 at 12:12 AM, Takayuki Muranushi wrote: > Dear everyone, > > I have a code > https://github.com/nushio3/practice/blob/master/instance-inference/zipf-11-1.hs > > that produces a type-error when I remove a type signature. > https://github.com/nushio3/practice/blob/master/instance-

Re: [Haskell-cafe] Quasiquotation page on HaskellWiki needs updating

2012-11-25 Thread adam vogt
On Sat, Nov 24, 2012 at 1:32 AM, Erik de Castro Lopo wrote: > Hi all, > > It seems the Quasiquotation page on HaskellWiki > > http://www.haskell.org/haskellwiki/Quasiquotation > > has fallen behind the actually Quasiquotation implementation that > is in ghc-7.4.2 and later. > > Specifically, t

Re: [Haskell-cafe] ANN: has-0.4 Entity based records

2010-05-19 Thread adam vogt
On Thu, May 13, 2010 at 7:16 PM, HASHIMOTO, Yusaku wrote: > Sorry for spamming, what I wanted to write is I think `has' has better > interface than other record packages in types. > > There are many libraries to write function "takes an record has Foo > and Bar and returns something." But writing

Re: [Haskell-cafe] ANN: has-0.4 Entity based records

2010-05-10 Thread adam vogt
On Tue, May 4, 2010 at 12:18 PM, HASHIMOTO, Yusaku wrote: > This library is inspired by HList[2], and interfaces are stealed from > data-accessors[3]. And lenses[4], fclabels[5], and records[6] devote > themselves to similar purposes. > > [2]: http://hackage.haskell.org/package/HList > [3]: http:/

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-05 Thread Adam Vogt
* On Sunday, May 02 2010, Alexander Dunlap wrote: >Of course, there are situations where it is really awkward to not use >partial functions, basically because you *know* that an invariant is >satisfied and there is no sane course of action if it isn't. To take a >contrived example: > >f ys = let x

Re: [Haskell-cafe] GHC, odd concurrency space leak

2010-04-17 Thread Adam Vogt
* On Wednesday, April 14 2010, Jesper Louis Andersen wrote: >> newtype Process a b c = Process (ReaderT a (StateT b IO) c) >> deriving (Functor, Monad, MonadIO, MonadState b, MonadReader a) > >Note that the automatic derivations of *MonadState b* and *MonadReader a* makes >GHC spit our some mkUs

Re: [Haskell-cafe] beginner question: assigning local variable to a function

2009-05-07 Thread adam vogt
This is most likely attributable to the use of different compilers. I don't see how accepting such a variant can cause ambiguity, but I'm not quite sure whether it is legal H98. On 5/6/09, Magnus Therning wrote: > Brandon S. Allbery KF8NH wrote: > > On May 6, 2009, at 12:18 , Nico Rolle wrote: >

Re: [Haskell-cafe] DSLs with {in,}equalities

2009-03-12 Thread Adam Vogt
This seems to be in ghc for those reasons: http://www.haskell.org/haskellwiki/Quasiquotation * On Monday, March 02 2009, Andrew Hunter wrote: >Several times now I've had to define an EDSL for working with >(vaguely) numeric expressions. For stuff like 2*X+Y, this is easy, >looking pretty much li

Re: [Haskell-cafe] ANN: The Typeclassopedia, and request for feedback

2009-02-17 Thread Adam Vogt
* On Monday, February 16 2009, Andrew Coppin wrote: > I do have one little question. Let me see if I can find the quote... Ah, > here we go: > > "The WrappedMonad and WrappedArrow constructors witness the fact that > any Monad and any Arrow can be made into an Applicative." > > I don't really

Re: [Haskell-cafe] Data.List.Split

2008-12-13 Thread Adam Vogt
* On Saturday, December 13 2008, Gianfranco Alongi wrote: >I have actually been thinking about a similar thing, but on the "group" >subject. >One can actually group things in many ways, such as groupBy (==) , so >that groupBy (==) [1,2,1,2] should give >[[1,1],[2,2]]. Of course other ideas are po

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Adam Vogt
* On Thursday, June 19 2008, Ketil Malde wrote: >As a side note, may I advise you to use another symbol, and leave the >poor dot alone? Overloading it as a module separator is bad enough. >If you have a keyboard that allows greater-than-ascii input, there are >plenty of options: « » ¡ £ ¥ ł € ® ª.

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-09 Thread Adam Vogt
* On Monday, June 09 2008, Duncan Coutts wrote: >> And - is there a way to make GHCi use aliased qualification? I find >> my self typing detailed taxonomies all the time there. > >The ghci syntax currently is: >:m Data.Set >wouldn't it be much nicer as: >import Data.Set >then we could have the obv