HList is just an abstract type, you can't directly instantiate it, so I believe has kind *
There are also two subclasses: HNil, which is a singleton and has kind * HCons, which takes an existing HList and an additional type, so has the kind * -> * -> * I'm not 100% certain here, so someone may have to correct me :) On 4 September 2010 13:09, Andreas S. <[email protected]> wrote: > Hi Kevin! > If List conforms to :* -> * > then what would be the term for a HOList(High wizardry in the Land of > Scala)? > > regards Andreas > > On Sep 3, 12:56 am, Kevin Wright <[email protected]> wrote: > > If a thing can be done, then it WILL be done, there's always going to be > > somebody out there perverse enough to try it > > Almost any tool is open to abuse. The more flexible it is, the more > > abusable it becomes: > > > > http://thereifixedit.failblog.org/ > > > > C++ templates for example, while a long time favourite of obfuscation > > contests, have also resulted in some amazing work: > http://www.boost.org/doc/libs/ > > > > You'll not be surprised to hear that Scala's type system is no different > in > > this regard. > > > > Broadly speaking, there are two important concepts really being explored > by > > more experienced Scala users; Google on either of these terms with scala, > > and you'll come up with a wealth of links: > > > > "type classes" :http://en.wikipedia.org/wiki/Type_class > > <http://en.wikipedia.org/wiki/Type_class>and "kinds" : > http://en.wikipedia.org/wiki/Kind_(type_theory) > > > > One example of a type class is scala.Numeric, which allows you to define > an > > algorithm in such a way that it'll operate over ANY type capable of a few > > simple operations (plus, minus, divide, etc.) and do so in a completely > > type-safe manner, without need of duck typing, etc. > > > > This is an EXTREMELY powerful abstraction, once you consider that > concepts > > such as matrices, complex numbers, waveforms, linear equations, etc. can > all > > be added/subtracted/whatever and so can be considered Numeric. > > > > Kinds are one level of abstraction up from types. For example, List can > be > > seen as a Kind * -> * i.e. it takes a type (e.g. Int) and yields a type > > (e.g. List[Int]). Map is * -> * -> * (takes two types, and yields one). > In > > terminology, you'll often see List described as a type constructor, > whereas > > List[Int] is a Type. List is absolutely not a raw type, Scala doesn't > have > > such things! > > > > Scala allows you to generically define an algorithm so that it'll operate > > over a particular Kind (not just a specific type). > > scalaz, for example, defines a number of operations that can operate over > > anything of kind * -> * > http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/... > > (disclaimer: This is bleeding edge, brain melting, academic stuff of the > > sort that scares people off, it is absolutely NOT day-to-day Scala so > please > > don't let it put you off! It does however show how far things can be > pushed > > if you are so minded, not unlike C++ templates then) > > > > And a few more interesting links, hopefully a lot more approachable than > > scalaz :) > > > > Quick interview with Bill Venners and Martin Odersky: > http://www.artima.com/scalazine/articles/scalas_type_system.html > > > > Collection of articles on metaprogramming with types: > http://apocalisp.wordpress.com/2010/06/08/type-level-programming-in-s... > > > > presentation on type classes: > http://lampwww.epfl.ch/~odersky/talks/wg2.8-boston06.pdf > > > > Generics of a Higher Kind: > http://people.cs.kuleuven.be/~adriaan.moors/files/genericshk/tcpoly.pdf > > > > video and slides on "High wizardry in the Land of Scala", covering type > > classes and Kinds::http://vimeo.com/13518456 > > > > SO question illustrating a practical application of the Numeric type > class: > http://stackoverflow.com/questions/1252915/scala-how-to-define-generi... > > > > 2010/9/2 Cédric Beust ♔ <[email protected]> > > > > > > > > > > > > > On Thu, Sep 2, 2010 at 2:20 PM, Graham Allan < > [email protected]>wrote: > > > > >> One thing that the page doesn't include (AFAICT) is a discussion of > what > > >> you > > >> have referred to elsewhere on this mailing list as a 'Turing-complete > type > > >> system'. > > > > > It's the kind of feature that enables hacks such as this one< > http://en.wikibooks.org/wiki/C%2B%2B_Programming/Templates/Template_M...>. > > > If you don't feel like reading it, somebody managed to create C++ > templates > > > which, when fed to the compiler, will produce error messages that list > prime > > > numbers. > > > > > It's awesomely clever but why you would put this as a requirement to > > > choosing a language is beyond me. If you don't think that this makes a > > > language complex, you are probably hanging out with people who love > Haskell > > > and who can tell you the difference between a catamorphism and an > > > anamorphism in their sleep. > > > > > -- > > > Cédric > > > > -- > > Kevin Wright > > > > mail / gtalk / msn : [email protected] > > pulse / skype: kev.lee.wright > > twitter: @thecoda > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<javaposse%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > -- Kevin Wright mail / gtalk / msn : [email protected] pulse / skype: kev.lee.wright twitter: @thecoda -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
