Created
April 9, 2020 11:04
-
-
Save monadplus/017d4afa9e57200d5ef392210e8a4e7c to your computer and use it in GitHub Desktop.
from Int to Nat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import GHC.TypeLits | |
import Data.Proxy | |
import Data.Maybe | |
import System.IO | |
main :: IO () | |
main = do | |
putStrLn "Write an integer" | |
x <- readLn | |
printNat $ fromJust (someNatVal x) | |
printNat :: SomeNat -> IO () | |
printNat (SomeNat p) = print . natVal $ p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment