mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
core: make NULL Ptr a instead of a
This commit is contained in:
parent
322fe028db
commit
32d4095a5d
@ -56,10 +56,9 @@ It is the inverse of [`just?`](#just?).")
|
||||
(doc unsafe-ptr "Creates a `(Ptr a)` from a `(Maybe a)`. If the `Maybe` was
|
||||
`Nothing`, this function will return a `NULL` value.")
|
||||
(defn unsafe-ptr [a]
|
||||
(the (Ptr a) (Unsafe.coerce
|
||||
(match-ref a
|
||||
(Nothing) NULL
|
||||
(Just _) (the (Ref (Maybe a)) a)))))
|
||||
(match-ref a
|
||||
(Nothing) NULL
|
||||
(Just _) ((the (Fn [(Ref (Maybe a))] (Ptr a)) Unsafe.coerce) a)))
|
||||
|
||||
(doc from-ptr "Creates a `(Maybe a)` from a `(Ptr a)`. If the `Ptr` was
|
||||
`NULL`, this function will return `Nothing`.")
|
||||
|
@ -309,7 +309,7 @@ startingGlobalEnv noArray =
|
||||
, envMode = ExternalEnv
|
||||
, envFunctionNestingLevel = 0
|
||||
}
|
||||
where bindings = Map.fromList $ [ register "NULL" (VarTy "a")
|
||||
where bindings = Map.fromList $ [ register "NULL" (PointerTy (VarTy "a"))
|
||||
]
|
||||
++ (if noArray then [] else [("Array", Binder emptyMeta (XObj (Mod arrayModule) Nothing Nothing))])
|
||||
++ [("StaticArray", Binder emptyMeta (XObj (Mod staticArrayModule) Nothing Nothing))]
|
||||
|
Loading…
Reference in New Issue
Block a user