There are a lot of ways to do this sort of thing, and which one you choose will depend on exactly what you're trying to do. For example, you can write something vaguely like
data Nat = Z | S Nat
data SL (n :: Nat) a where
Nil :: SL Z
Cons :: a -> SL n a -> SL (S n) aplot :: forall (n::Nat) . (SL n Double -> Double) ->
SL n (Double, Double) -> IO ()On Mar 11, 2015 5:45 PM, "Sumit Sahrawat, Maths & Computing, IIT (BHU)" <sumit.sahrawat.apm13@iitbhu.ac.in> wrote:_______________________________________________Hi everybody,I have a function of typeplot :: ([Double] -> Double) -- A function to plot-> [(Double, Double)] -- Range for all arguments-> IO ()I want to enforce the fact that ranges for all arguments should be provided.Is there a way to make the type system enforce it?--RegardsSumit Sahrawat
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe