FAQ Database Discussion Community


Composing type-level functions with implicit witnesses

scala,type-systems,implicits,path-dependent-type,type-level-computation
I am experimenting with some rather complex type-level calculations. There, I have some type tags (say, A, B, and C), and functions working on them, which are represented by implicit witnesses with path-dependent result types: class A class B class C trait F1[T] { type result } trait F2[T] {...

Implicit Generic.Aux missing on conversion from Shapeless HList to case class

scala,shapeless,type-level-computation
I just recently started learning scala and today I decided I wanted to write a CSV parser that would load nicely into case classes but store the data in rows (lists) of Shapeless's HList object so that I could get some exposure to type-level programming. Here's what I have so...

Can HListElim be composed with another function?

haskell,type-level-computation,hlist
Given {-# LANGUAGE TypeFamilies, KindSignatures #-} {-# LANGUAGE GADTs, DataKinds, TypeOperators #-} import Data.HList import Data.Singletons import Data.Singletons.Prelude.List type family HListElim (ts :: [*]) (a :: *) :: * where HListElim '[] a = a HListElim (t ': ts) a = t -> HListElim ts a hListUncurry :: HListElim ts...

Unexpected implicit resolution in scala

scala,types,implicit,type-level-computation
I was trying to work out some simple examples of type-level programming in Scala 2.11. Here is a function to tell type equality: def type_==[A, B](implicit ev: A =:= B = null) = ev != null Here =:= is defined in the prelude, but for our purpose, even a simple...

Fold over a heterogeneous, compile time, list

haskell,type-level-computation,hlist
I have a list of heterogeneous types (or at least that's what I have in mind): data Nul data Bits b otherBits where BitsLst :: b -> otherBits -> Bits b otherBits NoMoreBits :: Bits b Nul Now, given an input type b, I want to go through all the...