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

2013-10-12 Thread Paolino
Hello everyone, I'm still trying to resolve my problem. I try to restate it in a simpler way. Is it possible to write extract and update functions for L ? import Data.Nat data family X (n::Nat) :: * data L (n::Nat) where Q :: L (Succ n) - X n - L n E :: L n extract :: L Zero - X n

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

Re: [Haskell-cafe] ordNub

2013-10-12 Thread Niklas Hambüchen
I would like to come back to the original question: How can ordNub be added to base? I guess we agree that Data.List is the right module for a function of type Ord a = [a] - [a], but this introduces * a cyclic dependency between Data.List and Data.Set * a base dependency on containers. What is

Re: [Haskell-cafe] ordNub

2013-10-12 Thread Anthony Cowley
On Oct 12, 2013, at 2:47 PM, Niklas Hambüchen m...@nh2.me wrote: I would like to come back to the original question: How can ordNub be added to base? I guess we agree that Data.List is the right module for a function of type Ord a = [a] - [a], but this introduces * a cyclic

Re: [Haskell-cafe] ordNub

2013-10-12 Thread Niklas Hambüchen
On 12/10/13 20:43, Anthony Cowley wrote: I think nub's behavior is rather set-related, so I don't really understand the objection to putting it in Data.Set. In sets, the order does not matter, while for nub it does. nub:: Eq a = [a] - [a] ordNub :: Ord a = [a] - [a] both do not

Re: [Haskell-cafe] ordNub

2013-10-12 Thread Roman Cheplyaka
* Anthony Cowley acow...@seas.upenn.edu [2013-10-12 15:43:57-0400] On Oct 12, 2013, at 2:47 PM, Niklas Hambüchen m...@nh2.me wrote: I would like to come back to the original question: How can ordNub be added to base? I guess we agree that Data.List is the right module for a

[Haskell-cafe] Haskellers in Nashville,TN

2013-10-12 Thread heathmatlock
Anyone here from the Nashville, TN area? t would be nice to meet regularly with others to discuss and work with Haskell. Also, this group is now available: www.meetup.com/The-Haskell-Study-Group/ If you want to participate remotely, that works too, I'm just looking for others to meet with

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

2013-10-12 Thread Richard Eisenberg
Yes, it's possible, but it's rather painful. Here is my working attempt, written to be compatible with GHC 7.6.3. Better ones may be possible, but I'm doubtful. {-# LANGUAGE TemplateHaskell, RankNTypes, TypeFamilies, TypeOperators, DataKinds, ScopedTypeVariables, GADTs, PolyKinds