-------------------------------------------------------------------------------- -- Copyright © 2011 National Institute of Aerospace / Galois, Inc. -------------------------------------------------------------------------------- -- | Initial values for a given type. {-# LANGUAGE Safe #-} {-# LANGUAGE GADTs #-} module Copilot.Core.Type.Uninitialized ( uninitialized ) where import Copilot.Core.Type -------------------------------------------------------------------------------- -- | Initial value for a given type. -- -- Does not support structs or arrays. uninitialized :: Type a -> a uninitialized :: Type a -> a uninitialized Type a t = case Type a t of Type a Bool -> a Bool False Type a Int8 -> a 0 Type a Int16 -> a 0 Type a Int32 -> a 0 Type a Int64 -> a 0 Type a Word8 -> a 0 Type a Word16 -> a 0 Type a Word32 -> a 0 Type a Word64 -> a 0 Type a Float -> a 0 Type a Double -> a 0