-
-
Save alexy/f7069876e0155e0ec997 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> runMain ammonite.repl.Repl | |
[info] Running ammonite.repl.Repl | |
Loading Ammonite Repl... | |
@ load.ivy("com.chuusai" %% "shapeless" % "2.1.0") | |
@ import shapeless._ | |
import shapeless._ | |
@ 1 :: "lol" :: List(1, 2, 3) :: HNil | |
res2: Int :: String :: List[Int] :: HNil = ::( | |
1, | |
::("lol", ::(List(1, 2, 3), HNil)) | |
) | |
@ import ammonite.pprint._ | |
import ammonite.pprint._ | |
@ implicit val hnilPPrinter: PPrinter[HNil] = PPrinter[HNil] { (hnil, cfg) => Iterator("HNil") } | |
hnilPPrinter: PPrinter[HNil] = ammonite.pprint.PPrinter$$anon$1@3e8db096 | |
@ implicit def hlistPPrinter[T <: HList, H](implicit | |
tailPPrinter: PPrinter[T], | |
headPPrint: PPrint[H] | |
): PPrinter[H :: T] = PPrinter { case (h :: t, cfg) => | |
headPPrint.render(h) ++ Iterator(" :: ") ++ tailPPrinter.render(t, cfg) | |
} | |
defined function hlistPPrinter | |
@ 1 :: "lol" :: List(1, 2, 3) :: HNil | |
res6: Int :: String :: List[Int] :: HNil = 1 :: "lol" :: List(1, 2, 3) :: HNil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment