Re: [問題] '#'的意思

看板PLT (程式語言與理論)作者 (Josh Ko)時間12年前 (2012/12/30 19:49), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《etwas (i'm only dust)》之銘言: : 各位版友好 : 想請問在source code中 '(#', '#)'是什麼意思? 例如: : instance Monad (ST s) where : return x = ST (\ s -> (# s, x #)) : 這在哪裡的文件有提到呢? : 謝謝 這是 GHC 的 unboxed tuples: Unboxed tuples are used for functions that need to return multiple values, but they avoid the heap allocation normally associated with using fully-fledged tuples. When an unboxed tuple is returned, the components are put directly into registers or on the stack; the unboxed tuple itself does not have a composite representation. Many of the primitive operations listed in primops.txt.pp return unboxed tuples. In particular, the IO and ST monads use unboxed tuples to avoid unnecessary allocation during sequences of operations. 以上摘自 http://www.haskell.org/ghc/docs/latest/html/users_guide/primitives.html -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 86.2.123.53

12/31 08:06, , 1F
感謝解惑!
12/31 08:06, 1F
文章代碼(AID): #1Gu2fMdA (PLT)
討論串 (同標題文章)
本文引述了以下文章的的內容:
0
3
完整討論串 (本文為第 2 之 2 篇):
0
3
0
1
文章代碼(AID): #1Gu2fMdA (PLT)