Skip to content

Commit

Permalink
#199 Created ArrNonParam.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Nov 22, 2022
1 parent e2333a1 commit 394f087
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Util/src/Arr/Arr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ trait Arr[+A] extends Any with Sequ[A]
def unsafeSetElemSeq(index: Int, elems: Iterable[A] @uncheckedVariance): Unit = elems.iForeach(index){(i, a) => unsafeSetElem(i, a) }
}

/** [[ShowT] type class for showing [[DataGen]][A] objects. */
class ArrShowT[A, R <: Arr[A]](val evA: ShowT[A]) extends ShowTSeqLike[A, R]
{
override def syntaxDepthT(obj: R): Int = obj.foldLeft(1)((acc, a) => acc.max(evA.syntaxDepthT(a)))
override def showDecT(obj: R, style: ShowStyle, maxPlaces: Int, minPlaces: Int): String =
typeStr + evA.typeStr.enSquare + obj.map(a => evA.showDecT(a, style, maxPlaces, minPlaces))
}

trait ArrSingle[+A] extends Any with Arr[A]
{
/** This method should rarely be needed to be used by end users, but returns a new uninitialised [[SeqSpec]] of the this [[Arr]]'s final type. */
Expand Down Expand Up @@ -77,10 +85,4 @@ trait ArrSingle[+A] extends Any with Arr[A]
}
}

/** [[ShowT] type class for showing [[DataGen]][A] objects. */
class ArrShowT[A, R <: Arr[A]](val evA: ShowT[A]) extends ShowTSeqLike[A, R]
{
override def syntaxDepthT(obj: R): Int = obj.foldLeft(1)((acc, a) => acc.max(evA.syntaxDepthT(a)))
override def showDecT(obj: R, style: ShowStyle, maxPlaces: Int, minPlaces: Int): String =
typeStr + evA.typeStr.enSquare + obj.map(a => evA.showDecT(a, style, maxPlaces, minPlaces))
}
trait ArrNonParam[+A] extends Any with ArrSingle[A]

0 comments on commit 394f087

Please sign in to comment.