hlist Questions

1

Solved

I'm pretty new to shapeless so the question might be easy. Here is the ADT: sealed trait Test final case class A() extends Test final case class B() extends Test final case class C() extends Test ...
Schmooze asked 17/10, 2020 at 22:26

1

Solved

I got json like {"name":"susan","age":25},and a hint to json keyset like "name:String,age:Int",how to create a HList from that json?
Tracitracie asked 28/9, 2020 at 13:5

1

Solved

I am trying to implement a method that does parameterized folding on a HList provided by the caller. The HList can have any number of elements (> 0) of the same type. val list = "a" :: "b" :: "c" ...
Puttier asked 28/8, 2019 at 7:26

3

I searched Hackage and couldn't find anything like the following but it seems to be fairly simple and useful. Is there a library that contains sort of data type? data HList c where (:-) :: c a =&...
Reaganreagen asked 12/9, 2017 at 1:27

1

Solved

lets say I have the following class hierarchy: sealed trait Animal case class Cat(isFriendly: Boolean) extends Animal case class Dog(color: String) extends Animal case class Fish(isFreshWater: Bo...
Sisson asked 6/6, 2017 at 6:20

1

Suppose I'd like to traverse case class generic representation as described here I've defined some typeclass to describe fields: trait Described[X] extends (X => String) object Described{ de...
Isborne asked 27/8, 2015 at 13:33

2

Of course, producing a Cartesian product of heterogeneous lists can be done in a number of way in Haskell, such as: [(x,y) | x <- [1,2,3], y <- [4,5,6]] or (,) <$> [1,2,3] <*>...
Helmer asked 24/2, 2017 at 12:14

3

I have done a few implementations of HList now. One based on Daniel Spiewak's High Wizardry in the Land of Scala talk and another based on a post in Apocalisp blog. The goal was to have a heterogen...
Lobation asked 18/3, 2011 at 8:13

1

Solved

I've been trying to map the types of an HList from scala's shapeless package without having access to their values. The following succeeds in mapping the values of an HList import shapeless._ imp...
Klausenburg asked 2/10, 2016 at 23:44

1

Solved

I would like to create the equivalent of: def toTupleN[A1, ..., AN, L <: HList](l: L): TupleN[A1, ..., AN] Code using toTupleN should compile only when there is exactly one N combination of v...
Platto asked 18/1, 2016 at 17:55

1

Solved

I'd like to build the equivalent of: def applyWithHList2[A1, A2, R, L <: HList](l: L, f: Function2[A1, A2, R]): Try[R] The values in the list are such that in the N choose 2 possible value co...
Sweepstakes asked 18/1, 2016 at 1:0

1

Solved

I'm trying to abstract over the android.os.Bundle API, aiming to generate Bundles in this fashion: case class MyClass( a: Int, b: String ) val mc = MyClass( 3, "5" ) implicit val bundleable = Bund...
Olericulture asked 5/11, 2015 at 0:44

1

Solved

Question 1 - Basic LUBConstraints My first try playing around with existing LUBConstraints fails for missing evidence (see code block below). Any hint why? Isn't an empty list a valid list of long...
Protectionism asked 25/9, 2015 at 9:13

1

Solved

The following code seems obvious enough to compile and run case class Pair(a: String, b: Int) val pairGen = Generic[Pair] object size extends Poly1 { implicit def caseInt = at[Int](x => 1) ...
Td asked 8/9, 2015 at 0:49

1

Solved

Slick's support for HList is generally a great thing. Unfortunately, it comes with its own implementation that does barely provide any useful operations. I'd therefore like to use the shapeless HLi...
Toon asked 1/8, 2015 at 17:49

1

Solved

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 Nu...
Crispation asked 17/6, 2015 at 8:53

4

Solved

I am really interested in finding out where the differences are, and more generally, to identify canonical use cases where HLists cannot be used (or rather, don't yield any benefits over regular li...
Rummage asked 6/8, 2012 at 8:51

1

Solved

I think I need a HList that is constrained to have all of its elements being a subtype of a certain type. LUBConstraint seems to be what I want, and indeed it does constrain the construction of suc...
Rampageous asked 19/5, 2015 at 9:40

2

Solved

I am currently implementing a library to serialize and deserialize to and from XML-RPC messages. It's almost done but now I am trying to remove the boilerplate of my current asProduct method using ...
Copulative asked 20/4, 2015 at 20:10

1

Solved

I am trying to transform the following HList Some(C(15)) :: None :: Some(B(55)) :: None :: Some(A(195)) :: HNil to C(15) :: B(55) :: A(195) :: HNil Here is what I have at the moment : im...
Veta asked 18/2, 2015 at 18:25

1

Solved

This does not compile and I do not understand why: import shapeless._ import poly._ object option extends (Option ~> List) { def apply[T](t: Option[T]) = t.toList } val simple = Some(1) :: S...
Childe asked 30/9, 2014 at 18:22

1

I'm trying to understand Shapeless, and I came across this: // Base trait for type level natural numbers. trait Nat { type N <: Nat } // Encoding of successor. case class Succ[P <: Nat]() ...
Slaton asked 10/6, 2014 at 17:8

1

I'm writing a SQL combinator which allows SQL fragments to be composed as a Monoid. I have roughly a type like this (this is a simplified implementation) : data SQLFragment = { selects :: [String]...
Contour asked 4/6, 2014 at 17:18

1

Solved

Say that I have a trait Show[T] such as the one in Scalaz: https://github.com/scalaz/scalaz/blob/scalaz-seven/core/src/main/scala/scalaz/Show.scala#L9 I also have a Shapeless HList that may look l...
Amandy asked 8/3, 2014 at 12:28

2

Solved

I'm currently writing Slick code to target an old schema with two tables > 22 columns. How do I use the new HList code? I've got 2.0-M3 working fine in other respects under Scala 2.10.3. Here's the...
Preamplifier asked 12/12, 2013 at 22:11

© 2022 - 2024 — McMap. All rights reserved.