Haskell “collections” language design

前端 未结 5 1883
耶瑟儿~
耶瑟儿~ 2021-02-07 03:21

Why is the Haskell implementation so focused on linked lists?

For example, I know Data.Sequence is more efficient with most of the list operations (except for the

5条回答
  •  野的像风
    2021-02-07 03:34

    With version 7.8, ghc supports overloading list literals, compare the manual. For example, given appropriate IsList instances, you can write

    ['0' .. '9']             :: Set Char
    [1 .. 10]                :: Vector Int
    [("default",0), (k1,v1)] :: Map String Int
    ['a' .. 'z']             :: Text
    

    (quoted from the documentation).

提交回复
热议问题