Add Cast instance for String to Nat
commitd579d27dfdbfd7624f1ed051c6ad5969b00ed917
authorEdwin Brady <ecb10@st-andrews.ac.uk>
dateSun 29 Nov 2015, 21:24 (11 years ago)
parent03b9980
libs/prelude/Prelude/Nat.idr+3
@@ -214,6 +214,9 @@ instance MinBound Nat where
214214instance Cast Integer Nat where
215215 cast = fromInteger
216216
217+instance Cast String Nat where
218+ cast str = cast (the Integer (cast str))
219+
217220||| A wrapper for Nat that specifies the semigroup and monad instances that use (*)
218221record Multiplicative where
219222 constructor GetMultiplicative
test/proofsearch002/proofsearch002.idr−3
@@ -24,9 +24,6 @@ mathsServer = do Lift $ putStrLn "Serving maths!"
2424 Pure (fact k, ()))
2525 Loop mathsServer
2626
27−instance Cast String Nat where
28− cast orig = cast (the Integer (cast orig))
29−
3027-- Start up a couple of servers, send them requests
3128testProg1 : Program () (const Void)
3229testProg1 = do -- with Process do