Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hierarchical module name for type-level programs

So let's say I wrote some type-level program in Haskell:

type family NAryFn (n::Nat) (dom::*) (cod::*) :: *
type instance NAryFn Ze dom cod = cod
type instance NAryFn (Su n) dom cod = dom -> NAryFn n dom cod

I think this is useful and I want to use it all over my project. So I put it in a module.

What would be a good hierarchical name for the module? (c.f. Haskell Hierarchical Modules)

A lot of data structures live in Data (Data.Text, Data.List, etc), various ways of structuring effects are in Control such as Control.Monad or Control.Applicative.

Where should type-level programs live? Type? TypeFamily? Has consensus developed yet?

like image 744
Lambdageek Avatar asked Mar 08 '13 01:03

Lambdageek


1 Answers

I checked on hackage, and most packages providing type level functionality live in the Data hierarchy, under Data.Type, Data.TypeLevel or the like, or sometimes Data.Number.Etc.TypeLevel. There are a few exceptions though.

The type-level-natural-number package lives under TypeLevel: http://hackage.haskell.org/package/type-level-natural-number

The tfp package lives under Types: http://hackage.haskell.org/package/tfp

A number of nicolas frisby's packages live under Type: http://hackage.haskell.org/package/type-booleans and http://hackage.haskell.org/package/type-cereal for example.

So there's no consensus at the moment, apparently. Personally I think Types is the appropriate place for all this stuff to go, but as is usual with the Haskell community, everything ends to end up in Data.

The perils of a language where nearly everything is first class, I suppose :-)

You can see some, but not all, of the type-level packages in the "Type System" category on hackage: http://hackage.haskell.org/packages/archive/pkg-list.html#cat:type%20system

like image 98
sclv Avatar answered Sep 20 '22 17:09

sclv