[Haskell-cafe] Rank N Kinds

2013-07-26 Thread Wvv
It was discussed a bit here: http://ghc.haskell.org/trac/ghc/ticket/8090 Rank N Kinds: Main Idea is: If we assume an infinite hierarchy of classifications, we have True :: Bool :: * :: ** :: *** :: :: ... Bool = False, True, ... * = Bool, Sting, Maybe Int, ... **= *, *->B

Re: [Haskell-cafe] Rank N Kinds

2013-07-28 Thread Wvv
Yes, True :: Bool :: * :: ** :: *** :: :: ... in Haskell is the same as True :: Bool :: Set0 :: Set1 :: Set2 :: Set3 :: ... in Agda And I'm asking for useful examples for *** (Set2 in Agda) and higher cheers Wvv 28 Jul 2013 at 8:44:08, Schonwald [via Haskell] (ml

Re: [Haskell-cafe] Rank N Kinds

2013-07-31 Thread Wvv
kNKinds we could write: data Foo (a::**) = Foo a data Bar (a::***) = Bar a So, now the task is more easy: I'm asking for useful examples with "CloseKinds" with ** and higher, and any useful examples for *** and higher cheers, Wvv 29 Jul 2013 at 14:44:50, José Pedro Magalhães [via H

Re: [Haskell-cafe] Rank N Kinds

2013-07-31 Thread Wvv
ool :: *) ) tupleL = TupleUnit 5 (TupleUnit "inside tuple" (TupleUnit True TupleNil))) fstTuppleL :: Int fstTuppleL = fstL tupleL -- = 2 sndTuppleL :: String sndTuppleL = sndL tupleL -- = "inside tuple" tlTuppleL :: TupleList ( (String :: *) -> (Bool :: *) ) tlTuppleL = tail

Re: [Haskell-cafe] Rank N Kinds

2013-08-01 Thread Wvv
g :: forrec c{1}. String -> String g = ("Hello " ++) g :: forrec c{2}. Bool -> Bool g = (True &&) And now it is possible to write signatures to `tmap` and `fmap` tmap :: forany i. forrec{i} a b c c' c''. c@( (a -> b) :: **) { -> c }

Re: [Haskell-cafe] Rank N Kinds

2013-08-01 Thread Wvv
I'm sorry, `instance Functor (TupleList (a :: **)) where ...` isn't right, sure. The right one is `instance Functor TupleList where ...` -- View this message in context: http://haskell.1045720.n5.nabble.com/Rank-N-Kinds-tp5733482p5733700.html Sent from the Haskell - Haskell-Cafe mailing list ar

Re: [Haskell-cafe] Rank N Kinds

2013-08-10 Thread Wvv
ool -> Bool :: **) -> (String :: **) ] t3 = [42 :: Int, (&&), "This is true *** type" ] > :k t3 * > head t3 42 :: Int > (head $ tail t3) True True True :: Bool Wvv 2 Aug 2013 at 5:34:26, Daniel Peebles [via Haskell] (ml-node+s1045720n5733708...@n5.nabble.co

[Haskell-cafe] Proposal: Polymorphic typeclass and Records

2013-08-28 Thread Wvv
Let we have data in one module as this: data Person = Person { personId :: Int, name :: String } data Address a = Address { personId :: Int, address :: String , way :: a} It was discussed a lot in topics "OverloadedRecordFields" This is an alternative: Let we have polymorphic

Re: [Haskell-cafe] Proposal: Polymorphic typeclass and Records

2013-09-01 Thread Wvv
Thanks! You do a great job! Adam Gundry wrote >> Haskell doesn't allow classes to be polymorphic in the names of their >> methods Yes, still not (( -- View this message in context: http://haskell.1045720.n5.nabble.com/Proposal-Polymorphic-typeclass-and-Records-tp5735096p5735365.html Sent fr

[Haskell-cafe] Proposal: Generic conditions for 'if' and 'case'

2013-09-01 Thread Wvv
I think it is an old idea, but nevertheless. Now we have next functions: if (a :: Bool) then x else y case b of a1 :: Bool -> x1 a2 :: Bool -> x2 ... Let we have generic conditions for 'if' and 'case': class Boolean a where toBool :: a -> Bool instance Boolean Bool where toBool = id in

Re: [Haskell-cafe] Proposal: Generic conditions for 'if' and 'case'

2013-09-02 Thread Wvv
Thanks! It is a good toy for testing! Nicolas Trangez wrote > Here's an example implementing your proposal: > > {-# LANGUAGE RebindableSyntax #-} > > import Prelude > > class Boolean a where > toBool :: a -> Bool > > instance Boolean Bool where > toBool = id > > instance Boolean [a]

Re: [Haskell-cafe] Unary functions and infix notation

2013-09-06 Thread Wvv
But we can do next: Prelude> :set XPostfixOperators Prelude> let z = (\y -> True) :: a -> Bool Prelude> :t (True `z`) But still `z` True ~\a -> a `z` True~ \a -> z a True and `z` must be a function with minimum 2 arguments -- View this message in context: http://haskell.

[Haskell-cafe] Proposal: Pragma EXPORT

2013-09-16 Thread Wvv
I suggest to add instead of (or with) export section Pragma EXPORT: We have 3 values: public, abstract and private. Data(with newtypes and types,..) could be public, like `Data(...)` or abstract `Data`. Other cases abstract = public. {-# EXPORT #-} pragma is valid till next {-# EXPORT #-}. We

[Haskell-cafe] Why superclass' instances are bad idea?

2013-09-24 Thread Wvv
I suggest to add superclass' instances into libraries. http://ghc.haskell.org/trac/ghc/ticket/8348 In brief, we could write next: >{-# LANGUAGE FlexibleInstances #-} >{-# LANGUAGE UndecidableInstances #-} > >instance Monad m => Applicative m where >pure = return >(<*>) = ap > >i

Re: [Haskell-cafe] Why superclass' instances are bad idea?

2013-09-26 Thread Wvv
Thanks a lot! This makes clear. I haven't noticed before that OverlappingInstances don't look at constraint! John Lato-2 wrote > This line > > instance Monad m => Applicative m where > > tells the compiler "Every type (of the appropriate kind) is an instance of > Applicative. And it needs

[Haskell-cafe] Proposal: RankedInstances

2013-09-26 Thread Wvv
The main power of Haskell is on instances. But Haskell instances system work fine with lower number of instances (rare instances). But we want hight density of instances! If we wish to have more selective instances we use `OverlappingInstances` (which are desined in a poor way) and if we still hav

Re: [Haskell-cafe] Proposal: new function for lifting

2013-09-27 Thread Wvv
Which "lift"? This one? class MonadTrans t where lift :: Monad m => m a -> t m a -- View this message in context: http://haskell.1045720.n5.nabble.com/Proposal-new-function-for-lifting-tp5737189p5737196.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. _

[Haskell-cafe] Newclasses

2013-10-02 Thread Wvv
"Newclasses" are not a new vision of classes! Not at all! Newclasses could elegant solve several instance problems! 1) we want to have "partly applied instances", like Parent2Child: Parent a => Child a like instance Applicative m => Monad m where return = pure

Re: [Haskell-cafe] Newclasses

2013-10-02 Thread Wvv
> Your first two cases will be fixed in 7.10, as Applicative finally becomes a superclass of Monad. Sure, newclassses not about Applicative and Monads only. This question is more wider. Must Apply be a superclass of Bind? Must Bind be a superclass of Monad? So, must Monad has 2 superclasses at o

Re: [Haskell-cafe] Newclasses

2013-10-03 Thread Wvv
endent of superclass functions and can't check dependence's laws, why does it order to have instances of unnecessary class? Stijn van Drongelen wrote > On Thu, Oct 3, 2013 at 8:16 AM, Wvv < > vitea3v@ > > wrote: > >> > Your first two cases will be fixed in

Re: [Haskell-cafe] Newclasses

2013-10-04 Thread Wvv
Thu, Oct 3, 2013 at 7:53 PM, John Lato < > jwlato@ > > wrote: > >> I don't really understand what a "newclass" is supposed to be. >> >> >> On Thu, Oct 3, 2013 at 2:15 PM, Wvv < > vitea3v@ > > wrote: >> >>> >>>

Re: [Haskell-cafe] Newclasses

2013-10-05 Thread Wvv
Stijn van Drongelen wrote > On Fri, Oct 4, 2013 at 10:31 PM, Wvv < > vitea3v@ > > wrote: >> About newclass and compose data, we can do next: >> >>newclass Foo [a] => FooList a where {containerMainipulation=...} >> >>newclass Foo (