[Haskell-cafe] Re: functional database queries

Albert Y. C. Lai trebla at vex.net
Wed Feb 21 14:30:54 EST 2007


apfelmus at quantentunnel.de wrote:
> Albert Y. C. Lai wrote:
>   
>> If and only if the database is a purely functional immutable data
>> structure, this can be done. [...]
>> Many interesting databases are not purely functional immutable; most
>> reside in the external world and can spontaneously change behind your
>> program's back.
>>     
> I don't think this is the problem because SQL requests are emitted
> atomically anyway. The (Query a) monad here has nothing to do with
> mutability of the data base.
>   

The same clock read twice, each reading atomic, can give two different 
results. (Cf. the monadic type signature of 
Data.Time.Clock.getCurrentTime.)

The same SELECT to the same database issued twice, each time atomic, can 
give two different results.

These are not referentially transparent.  These are not purely functional.

The notation is a beauty bonus.


More information about the Haskell-Cafe mailing list