Formatting

This commit is contained in:
alari 2018-09-08 19:25:38 +02:00
parent 3c0d3599d1
commit 8bc3f6c194
3 changed files with 10 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import fluence.hackethberlin.types.DataVyper
import shapeless.HList import shapeless.HList
class Contract[D <: HList](instructions: D)(implicit dv: DataVyper[D]) { class Contract[D <: HList](instructions: D)(implicit dv: DataVyper[D]) {
def toVyper: String = def toVyper: String =
dv.toVyperDefinitions(instructions).mkString("\n") dv.toVyperDefinitions(instructions).mkString("\n")
} }

View File

@ -1,6 +1,6 @@
package fluence.hackethberlin.types package fluence.hackethberlin.types
import fluence.hackethberlin.{FuncDef, types} import fluence.hackethberlin.{types, FuncDef}
import shapeless._ import shapeless._
import shapeless.labelled.FieldType import shapeless.labelled.FieldType
import shapeless.tag._ import shapeless.tag._
@ -36,7 +36,8 @@ sealed trait LowPriorityDataVyperImplicits {
data.toDataVyper :: Nil data.toDataVyper :: Nil
} }
implicit def funcDefDataVyper[Args <: HList, Ret <: types.Type, Params <: HList]: DataVyper[FuncDef[Args, Ret, Params]] = implicit def funcDefDataVyper[Args <: HList, Ret <: types.Type, Params <: HList]
: DataVyper[FuncDef[Args, Ret, Params]] =
new DataVyper[FuncDef[Args, Ret, Params]] { new DataVyper[FuncDef[Args, Ret, Params]] {
override def toVyperDefinitions(func: FuncDef[Args, Ret, Params]): List[String] = override def toVyperDefinitions(func: FuncDef[Args, Ret, Params]): List[String] =
func.toVyper :: Nil func.toVyper :: Nil