[Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-25 Thread oleg
Well, I guess you might be interested in geometric algebra then http://dl.acm.org/citation.cfm?id=1173728 because Geometric Algebra is a quite more principled way of doing component-free calculations. See also the web page of the author http://staff.science.uva.nl/~fontijne/

Re: [Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-25 Thread TP
Thanks Oleg, I have discovered geometric algebra some months ago. There is a textbook on the topic: http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470941634.html It seems very interesting, but I have not currently the time to make a detailed comparison with vector/tensor algebra. Moreover

Re: [Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-22 Thread TP
o...@okmij.org wrote: I'm late to this discussion and must have missed the motivation for it. Specifically, how is your goal, vector/tensor operations that are statically assured well-dimensioned differs from general well-dimensioned linear algebra, for which several solutions have been

[Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-17 Thread oleg
I'm late to this discussion and must have missed the motivation for it. Specifically, how is your goal, vector/tensor operations that are statically assured well-dimensioned differs from general well-dimensioned linear algebra, for which several solutions have been already offered. For example,

Re: [Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-10 Thread TP
Richard Eisenberg wrote: without ScopedTypeVariables, the n that you would put on your annotation is totally unrelated to the n in the instance header, but this is benign becau se GHC can infer the type anyway. With ScopedTypeVariables, the `n`s are the same, which luckily agrees with

[Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-09 Thread TP
Hi all, Following a discussion on Haskell-Cafe, Richard E. made the following proposition of a Singleton to make a correspondance between type-level integers and value-level integers: data SNat :: Nat - * where SZero :: SNat 'Zero SSucc :: SNat n - SNat ('Succ n) (found at [1], and

Re: [Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-09 Thread Richard Eisenberg
Hi TP, Here is slightly edited code that works: {-# LANGUAGE GADTs #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE ScopedTypeVariables #-} -- type level integers data Nat = Zero | Succ Nat deriving ( Show, Eq, Ord )

Re: [Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-09 Thread TP
I'm hoping that gets you moving again and seeing this helps you piece it all together. Thanks a lot Richard, It helped me a lot to move forward. No doubt your answer will be very useful for people looking for information on internet. - I changed the syntax of creating proxies. Instead of

Re: [Haskell-cafe] writing a function to make a correspondance between type-level integers and value-level integers

2013-06-09 Thread Richard Eisenberg
More good questions. On Jun 9, 2013, at 10:20 PM, TP wrote: In fact the extension ScopedTypeVariables is not needed to make your version work. However, if I extend a bit your version like that: snip So I don't understand why ScopedTypeVariables is needed in one case and not in the