Do all "fromList" functions redirect to List operations?

Hello all, I have a datatype like this: data Time = DPast | T Integer deriving (Eq, Show) data Temporal a = Temporal { at :: Time -> (a, Maybe Time) } and I wrote a fromList function to create one. The fromList function implements it own "at" function and wraps it in a Temporal. IIUC, this means that whenever I invoke "at" on a Temporal created from a List I actually operate on that List. Alternatively I can directly create a Temporal as in exNat = Temporal f where f DPast = (0, Just $ T 1) f (T t) = (t, Just $ T $ t+1) whose "at" function is a lot faster. Do all "fromList" functions behave this way, i.e. they redirect operations on the new type to List operations? Is there a way to make a Temporal, created via fromList "forget" its List heritage?
participants (1)
-
martin