Hello List!
Project:M36 v1.2.3 includes a new feature which allows developers to
write and import Haskell modules as-a-whole. This enables developers to
use standard Haskell functions within the database. Here's an example
module:
module TestFuncs (projectM36Functions, apply_discount) where
import ProjectM36.Module
apply_discount :: Integer -> Integer -> Integer
apply_discount age price =
if age <= 10 then
price `div` 2
else
price
The module is imported into a Project:M36 database like this:
loadmodulefromfile "TestFuncs.hs"
Once loaded, the new atom function can be used right away:
ticket_sales := relation{tuple{ticketId 123, base_price 20, actual_price
apply_discount(8,20)}}
This feature should greatly improve the ergonomics of running Haskell
code within Project:M36 databases. Enjoy!
https://hackage.haskell.org/package/project-m36-1.2.3
https://github.com/agentm/project-m36/blob/master/docs/import_haskell_module.markdown
Cheers,
M