Re: I added docs about Salt primitives.

6 views
Skip to first unread message

Ben Lippmeier

unread,
Mar 25, 2018, 7:24:10 AM3/25/18
to Matthew Yu, discu...@googlegroups.com
(cc-ing to the mailing list)

On 20 Mar 2018, at 12:28 pm, Ben Lippmeier <be...@ouroborus.net> wrote:

btw, I was wondering do you have any ideas why passing the Addr type to show results in a segmentation fault while there actually is a implementation in the C. ( never seen C code like that tho). 

I don’t know, I’ll check it out.

I looked into this. It turns out it wasn’t possible to use ‘Addr’ from the source language, so I assume you were calling the show function from Core Salt instead. If that is true then you’ll need to show me the example that crashes.

I just added the ability to use ‘Addr’ from Discus code, so the following works.

Ben.


module Main
import System.IO.Console

import foreign abstract type
 Mem : Effect

import foreign c value
 malloc : Nat#  -> S Mem Addr#
 free   : Addr# -> S Mem Void#

where

main ()
 = constant r in
   do   addr = malloc 100
        writel  $ show addr
        free addr
        ()

Reply all
Reply to author
Forward
0 new messages