Haskell: get memory address of a list -
is there way address of data element (say list element) in haskell.
combinelists :: [a] -> [a] -> [a] combinelists [] y = y combinelists (x:xs) y = x : combinelists xs y *main> let x=[1,23, 12, 45] *main> x [1,23,12,45] *main> let y =[90, 56, 78] *main> y [90,56,78] *main> let z = combinelists x y *main> z [1,23,12,45,90,56,78]
now z
constructed copying elements x , y (internal haskell representation) or
would z like: z = [ [copy of elements x] y]
i wanted see if &y == &z[4] (z[4] = 90).
also there way dump internal representation using similar ctypes in python.
thanks.
you can use stablename
or reallyunsafepointerequality#
(note name , don't use in real programs; you'll need magichash extension call it) check whether 2 expressions refer same object. see what advantages stablenames have on reallyunsafeptrequality#, , vice versa? differences.
Comments
Post a Comment