Re: [Haskell-cafe] ordNub

2013-10-13 Thread AntC
> Niklas Hambüchen nh2.me> writes: > > > On 14/10/13 03:20, AntC wrote: > > ... > > Then here's a further possible optimisation, instead of making > > separate calls to `member` and `insert`: > > This I understand again. Where do you get insert

Re: [Haskell-cafe] ordNub

2013-10-13 Thread AntC
> Niklas Hambüchen nh2.me> writes: > > > On 13/10/13 21:42, AntC wrote: > > ... > > If you use the Set library, that fact may be very visible! > > Because Set re-sequences the whole list, as per its Ord instance. > > > > But List.nub preserv

Re: [Haskell-cafe] ordNub

2013-10-13 Thread AntC
> Niklas Hambüchen nh2.me> writes: > > In sets, the order does not matter, while for nub it does. > Let's be careful here!. Niklas, when you say "order", do you mean: * the _ordering_ from the Ord instance? Or * the relative sequence of elements in the list? > ... the fact that Set is used ins

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread AntC
ntages over old-fashioned records. (But! We do need to solve the Field names problem. It's great that Adam's GSOC work has incorporated lenses.) AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] type constructor section for (-> Bool), _not_ ((->) Bool)

2013-09-04 Thread AntC
> Brent Yorgey seas.upenn.edu> writes: > > > On Tue, Sep 03, 2013 at 11:33:46AM +, AntC wrote: > > > > I want an instance and type improvement constraint of the form > > > > instance (f ~ (-> Bool)) => C Foo (f b) where ... > >

[Haskell-cafe] type constructor section for (-> Bool), _not_ ((->) Bool)

2013-09-03 Thread AntC
I'm probably being dumb, but Hoogle nor the wiki are helping me. I want an instance and type improvement constraint of the form instance (f ~ (-> Bool)) => C Foo (f b) where ... The first arg to C is driving type improvement, for example: instance (f ~ []) => C Bar (f b) where ... (The

Re: [Haskell-cafe] Retrieving Haddock comments with haskell-src-exts

2013-08-21 Thread AntC
ng the AST, and consumes/outputs each comment where the comment's Span falls between the nodes' Loc? Would this need too much lookahead? (And thank you to Adam for introducing me to the joys of source-munging. http://www.haskell.org/pipermai

Re: [Haskell-cafe] One-element tuple

2013-08-20 Thread AntC
is the original, though I think that would require working > with the messier Annotated syntax tree. > wow! Adam, thank you. Even copes with multiple nested parens nested parens instance C ((a, b)) c ... ==> instance C ((a, b)

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
Since I am working with tuples, I want the code to be clear where it's dealing with tuples vs the Haskell type infrastructure. Thanks Ivan for the dependencies list. No surprise that Hlist is using OneTuple <==> HCons a HNil. That need is exactly what I'm talking about, not a joke. Lenn

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
n (and ideas from Tropashko's 'Relational Lattice' [6]). Is there anybody using OneTuple 'in anger'? AntC [1] M. Shields and E.Meijer. Type-indexed rows. In Proceedings of the 28th ACM SIGPLAN-SIGACT symposium on Principles of Programming Languages, pages 261

Re: [Haskell-cafe] ordNub

2013-08-19 Thread AntC
> Richard A. O'Keefe cs.otago.ac.nz> writes: > > There are at least four different things that "an Ord version" might > mean: > > - first sort a list, then eliminate duplicates > - sort a list eliminating duplicates stably as you go >(think 'merge sort', using 'union' instead of 'merge') >

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
> Brent Yorgey seas.upenn.edu> writes: > > > > data Oneple a = Oneple a -- (or newtype) > > (Oneple $ CustId 47) -- too verbose > > > > This is what the OneTuple package is for: > Thank you Brent, and Ivan made the same suggestion. Apart from b

[Haskell-cafe] One-element tuple

2013-08-15 Thread AntC
-- too verbose type Oneple a = [a] [CustId 47] -- at least looks bracket-y What do you do? AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Why are field selectors functions? [was: ghc-users A possible alternative to dot notation for record access]

2013-07-18 Thread AntC
o` is clearly bound to an Int. So why is there this `foo` thing that isn't an Int? AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-10 Thread AntC
self.) Just don't do that! Use long_and_meaningful names. 50-100 near-identical lines of code sounds like an opportunity for an algorithm. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread AntC
Francesco Mazzoli mazzo.li> writes: > > I have stumbled upon a strange annoyance: > > {-# LANGUAGE GADTs #-} Hi Francesco, I think you'll find that the 'annoyance' is nothing to do with GADTs. I suggest you take the type signature off of foo1, and see what type ghc infers for it. It isn'

Re: [Haskell-cafe] HList records access time [was: Diving into the records swamp]

2013-04-28 Thread AntC
e same type appears twice in a tuple. (Contrast that HList uses a 'Lacks' pseudo-constraint/instance failure.) I hope Template Haskell would help with generating the instances for all of the n-tuples -- otherwise it's a lot of boilerplate. The tricky part comes with

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

2013-04-27 Thread AntC
the current situation ;-). I'm saying that many people find the Haskell record system 'as is' so dysfunctional that they give up on it! I feel strongly that as soon as we get past the name collissions, there'll be other blockages to using it. I'd be interested to

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

2013-04-27 Thread AntC
ay and in EmployeeTimeSheet.) [And this use case is what TP/DORF is primarily aimed at.] [**] Do I need to explain what data model normalisation is? I fear that so- called XML 'databases' mean academics don't get taught normalisation any more(?) AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2013-04-26 Thread AntC
s in common avoiding doubling-up those fields (aka Relational Natural Join). The DORF/TPDORF proposals are aimed much better as a step towards first- class record types. [IMO **] Oleg/Ralf's HList paper covers all the ground for first-class records. It depends heavily on overlaps, which is

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread AntC
to avoid the wasted space of sparse records, it could be a helpful discipline to design data structures without needing Maybe's. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] A yet another question about subtyping and heterogeneous collections

2012-10-22 Thread AntC
Dmitry Vyal gmail.com> writes: > > On 10/19/2012 06:14 AM, AntC wrote: > > Roman Cheplyaka ro-che.info> writes: > > [snip] > >>> instance (Upcast a b, Upcast b c) => Upcast a c where > >>>upcast = (upcast :: b -> a) . (upcast :: c -&

Re: [Haskell-cafe] A yet another question about subtyping and heterogeneous collections

2012-10-18 Thread AntC
y to handle this is using type functions (aka type families aka associated types), but I'm not sure how that would apply here. (And, for the record, the old-fashioned way would use functional dependencies, as per the Heterogenous Collections paper aka 'HList's). AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread AntC
better off using an imperative/object-oriented language? If you're trying to create a static data structure, perhaps the credit card transform is the approach to use? > ... I would like just to run some benchmarks and see the results. Running benchmarks for destructive updates in Haskell see

Re: [Haskell-cafe] Fixity declaration extension

2012-08-13 Thread AntC
Surely a case where explicit parens would be better. (Anything else we can bikeshed about while we're at it?) AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] CRIP: the Curiously Reoccuring Instance Pattern

2012-08-06 Thread AntC
ism gaining? And by the way, I couldn't help trying a bit of 'compiler archaeology'. I dug out Hugs version November 2002. My revised hDeleteMany works fine, as does my 'repair' to the example in 'Ended up in murky water'. So I can't see a need for TTypeable even back in 2004. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] CRIP: the Curiously Reoccuring Instance Pattern

2012-08-03 Thread AntC
that to build helper functions, then banish overlapping type classes? (I still think that explicitly dis-overlapped instances would be easier to understand.) AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] CRIP: the Curiously Reoccuring Instance Pattern

2012-08-02 Thread AntC
s.) 4. Instead of FunDeps, put TypeCasts on all of the instances. (Or other Class constraints to 'chain' typevars.) 5. And all of the instances must be framed with a bare typevar in the 'result'. (That is, a typevar distinct from any others in the head.) 6. (As you said to Ryan)

Re: [Haskell-cafe] CRIP: the Curiously Reoccuring Instance Pattern

2012-07-31 Thread AntC
out FunDeps -- and it works in Hugs (using TypeCast -- but looks prettier in GHC with equality constraints). Essentially it's a FunDep-like mechanism without FunDeps (as SPJ calls it), to achieve what Ryan's talking about. But you are quite right that we still need overlapping insta

Re: [Haskell-cafe] Using promoted lists

2012-06-07 Thread AntC
structure that means you have to scan down the structure to get to the element you want. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-06-04 Thread AntC
ere ought to be close correspondence to type-level functions. To me, NewAxioms is aiming at type-level case, to provide a different style of defining type functions, as well as dis-overlapping overlaps. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-05-31 Thread AntC
penetrable -- the TTypeable code is a tour de force). It's all so *dys-functional* (IMO). My take is that we should abandon Fundeps, and concentrate on introducing overlaps into type functions in a controlled way (what I've called 'dis- overlapped overlaps'.) AntC __

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-05-28 Thread AntC
that to work in Hugs with fundeps and no overlaps.) I'm surprised there isn't a Monad Transformer example: [3] by MPJ uses overlaps for MonadT. And MonadT was (I thought) what gave all the trouble with overlaps and default instances and silently changing behaviour. (There's a bri

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-05-26 Thread AntC
Gábor Lehel gmail.com> writes: > > On Fri, May 25, 2012 at 7:06 AM, AntC clear.net.nz> wrote: > > But it looks like the work SPJ pointed to is using closed style. ... > > If you're referring to the NewAxioms work Simon linked to in the other > thread, I don

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-05-24 Thread AntC
Twan van Laarhoven gmail.com> writes: > > On 24/05/12 14:14, AntC wrote: > > Simon Peyton-Jones microsoft.com> writes: > > > > Have you considered the alternative notation where multiple guards are allowed, > as in normal function definitions? Something

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-05-24 Thread AntC
e guards into account. [SPJ admits that such a restriction "loses part of the point of overlap in the first place."] >   > > Type families already implement the first of these.    > I believe that if we added the second and third, then overlap of type families would > be fine.  (I may live to eat my words here.)  > AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] [Haskell] Higher types in contexts

2012-03-05 Thread AntC
ch (without a wrapper, but with some fancy instance constraints) can 'dig out' the function and apply it polymorphically, but he can't get the function into the record without using an explicit data constructor. What am I doing wrong? AntC -- View this message in context: http:

[Haskell-cafe] What's the term for this? Alpha-reordering? [was: Re: FreeSect -- generalised sections syntax extension

2012-03-03 Thread AntC
d by a discussion on ghc-users re 'Records in Haskell'. There's a proposal using a typeclass with type arguments in a different order to the other proposals.] AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Records in Haskell

2012-03-01 Thread AntC
chanism then supports the idea of 'virtual' fields -- SPJ's example of fullName, built from polymorphic firstName and lastName. [By the way, did you mean to post to the cafe only? Most of the discussion is going on on ghc-users.] AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-20 Thread AntC
Gábor Lehel gmail.com> writes: > > On Mon, Feb 20, 2012 at 4:41 AM, AntC clear.net.nz> wrote: > > Folks, I've put my 'Record in Haskell' proposal on the wiki > > http://hackage.haskell.org/trac/ghc/wiki/Records  as suggestion 5 Declared > > Overl

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-19 Thread AntC
l.org/trac/ghc/wiki/Records as suggestion 5 Declared Overloaded Record Fields. Thanks to the voiciferousness on this thread, dot notation is completely optional. Feedback welcome. AntC -- View this message in context: http://haskell.1045720.n5.nabble.com/Some-thoughts-on-Type-Directed-Name-Res

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution -record update

2012-02-09 Thread AntC
ded, there's currently no way to put an expression in its place. So you still can't define a modifyConfig: you couldn't put anything in place of its (r -> a) parameter that could represent "x". Now in return for me answering that, please answer the questions in my earlier post about what limitations on update you'd like: * record-type changing? * Higher-ranked fields? * How many forall'd variables? * Constrained forall'd variables? Thank you AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution - record update

2012-02-09 Thread AntC
hen never change it? How many forall'd variables might you like in the HR field? - Do you want to put constraints on the HR's forall'd types? This is where the issue is stuck. Very possibly if we agree workable constraints, we're going to just run into further difficulties

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-06 Thread AntC
. Also we want the (pseudo-) fields to be updatable, which means field update needs to be polymorphic (overloaded). Then all I need is a type-(or kind-) level 'peg' for the name, and an instance for Has/get/set. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-06 Thread AntC
' when it comes to dot notation: A few little-known programming languages have for some reason bucked the well- established convention of small circle for function composition. There's certainly nothing about a dot that suggests function composition, *unless* ... AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-06 Thread AntC
Donn Cave avvanta.com> writes: > > Quoth AntC clear.net.nz>, > ... > > We're on the slippery slope! Where will it end? > > > > And now that I've found it, I so love: > > > > customer.lastName.tail.head.toUpper-- Yay! > >

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-03 Thread AntC
Gábor Lehel gmail.com> writes: > > On Fri, Feb 3, 2012 at 2:37 PM, AntC clear.net.nz> wrote: > > Do people really write code with huge pile-ups of functions prefix upon > > prefix? Wouldn't that be confusing even when it's unidirectional? > > Not real

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-03 Thread AntC
Gábor Lehel gmail.com> writes: > > On Fri, Feb 3, 2012 at 10:30 AM, AntC clear.net.nz> wrote: > > You seem to be not alone in wanting some special syntax for applying field > > selectors (see other posts on this thread). H98 field selectors don't do thi

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-03 Thread AntC
Kevin Quick sparq.org> writes: > > > Currently under H98: > >f.g-- (both lower case, no space around the dot) > > Is taken as function composition -- same as (f . g). > >f. g -- is taken as func composition (f . g) > >f .g -- is taken as func composition (f . g) >

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-01 Thread AntC
gineering' has got to be careful to 'fit in', and not use up too many of the options that are still available. What's special with dot syntax is it's well-established and with well- established (range of) meanings in other programming paradigms. If we introduce dot-notation into Haskell, we have to try to make it behave like those paradigms, but in a 'Haskelly' way. [To go a little off-topic/out of scope. My gold standard is polymorphic/anonymous records with concatenation, merge, projection, extension, everything you get in relational algebra. I don't want to use up all the design options just getting through the current namespace restrictions -- infuriating though they are.] AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-01 Thread AntC
Kevin Quick sparq.org> writes: > > > On Tue, 31 Jan 2012 23:10:34 -0700, Anthony Clayden > clear.net.nz> wrote: > > I'm proposing x.f is _exactly_ f x. That is, the x.f gets > > desugared at an early phase in compilation. > > Anthony, > > I think part of the concern people are expressing h

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-01-31 Thread AntC
Donn Cave avvanta.com> writes: > > Quoth AntC clear.net.nz>, > ... > > My proposal is that field selection functions be just ordinary functions, and > > dot notation be just function application(tight-binding). Then: > > object.fieldfuncmethod ==>

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-01-31 Thread AntC
ite in your familiar style, and can use polymorphic field selectors as plain functions (same syntax as presently). Those under the influence of OO can write dot notation, until they discover the joys of pointless style. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-01-26 Thread AntC
Steve Horne blueyonder.co.uk> writes: > > There's a proposal at the moment to add support for TDNR to Haskell > - to leverage "the power of the dot" (e.g. for intellisense).http://hackage.haskell.org/trac/haskell- prime/wiki/TypeDirectedNameResolution > I approve of the goal, ... S