Type-level Replicate function

Bas van Dijk v.dijk.bas at gmail.com
Fri Nov 21 08:51:53 UTC 2014


On 21 November 2014 09:21, Dr. ÉRDI Gergő <gergo at erdi.hu> wrote:
> I've replaced the definition of Replicate with a closed type family, and now
> isNull typechecks on 7.8.2:
>
> type family Replicate (n :: Nat) t : [*] where
>   Replicate 0 t = '[]
>   Replicate n t = t ': Replicate (n-1) t

Thanks that works beautifully!


More information about the Glasgow-haskell-users mailing list