Live data from Hacker News

Idris: Type safe printf [video]

youtube.com

1–10 of 16 posts

Re: Idris: Type safe printf [video]

#7
post #5

Really cool, but I am assuming printf only works for values which are determined at compile time?

AFAIK the value of the formatting string needs to be known at compile time. Only the types of the rest need to be known.

Actually, since it's dependently typed, we don't actually need to know the value of the formatting string; we just need a proof that the formatting string will match the other values. The easiest way to do this is to know what the string is, but we could also, for example, get these values from a function, then prove that the function produces matching values.

Re: Idris: Type safe printf [video]

#8
Why define Format as

    data Format = FInt Format
                | FString Format
                | FOther Char Format
                | FEnd
instead of using lists?

     data FormatPart = FInt | FString | FOther Char
     type Format = List FormatPart
Post reply on HN