[Haskell-cafe] how to make a KnownNat at runtime?

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Tue Nov 14 17:30:02 UTC 2017


On 14.11.2017 17:20, Greg Horn wrote:

> http://hackage.haskell.org/package/reflection-2.1.2/docs/Data-Reflection.html#v:reifyNat

Thanks! That is exactly what I want. - J.

main :: IO ()
main = getArgs >>= \ case
  [ s ] -> reifyNat (read s :: Integer) handle

handle :: forall (n::Nat) . KnownNat n => Proxy n -> IO ()
...


More information about the Haskell-Cafe mailing list