From d3a9803cf89ea94975934dd8abb18bbc12408a7e Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 6 Dec 2014 00:32:49 +1100 Subject: All newtype stubs now in their own files in their own subdir --- src/Grasp/Types/Instruction.hs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Grasp/Types/Instruction.hs (limited to 'src/Grasp/Types/Instruction.hs') diff --git a/src/Grasp/Types/Instruction.hs b/src/Grasp/Types/Instruction.hs new file mode 100644 index 0000000..0ff4002 --- /dev/null +++ b/src/Grasp/Types/Instruction.hs @@ -0,0 +1,32 @@ +module Grasp.Types.Instruction ( + Instruction, + + mk, + + toString, + toFloat + ) where + + + + +import Text.Read( readMaybe ) + + + + +newtype Instruction = Instruction String + deriving (Show, Eq) + + + + +mk :: String -> Instruction +mk = Instruction + +toString :: Instruction -> String +toString (Instruction i) = i + +toFloat :: Instruction -> Maybe Float +toFloat (Instruction i) = readMaybe i + -- cgit