[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-203804-105":59,"doc-detail-203804-en":130},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","bulk-types-a-programming-approach-using-haskell-constructor-classes","Bulk Types - A Programming Approach Using Haskell Constructor Classes","","Bulk types such as lists, bags, sets, maps, and priority queues are foundational in programming but are poorly supported by many languages despite long-standing attention, especially from the database community. This paper highlights key technical difficulties and proposes addressing them through Haskell’s constructor classes, aiming to improve how bulk operations and invariants are expressed and reasoned about. The work is presented at the 1997 Haskell Workshop in Amsterdam and builds on earlier 1996 workshop proceedings.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":40,"@type":76,"position":81},"https://docshare.wps.com/document/research-report/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/bulk-types-a-programming-approach-using-haskell-constructor-classes/203804/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/bulk-types-a-programming-approach-using-haskell-constructor-classes/203804.png","ImageObject",300,407,{"name":92,"@type":93},"Lucas Vance","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-10-08","2026-09-04",true,{"@type":102,"interactionType":103,"userInteractionCount":29},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"Why are lists considered a poor way to represent bulk types in functional programs?","Question",{"text":112,"@type":113},"Lists fail to encode invariants and expected operations in the type, making programs harder to understand, prove, and maintain. List operations may also have worse time complexity than operations on an appropriate abstract data type.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What two technical challenges does the paper focus on regarding polymorphism for bulk types?",{"text":117,"@type":113},"The paper discusses polymorphism both in the element type (element polymorphism) and in the collection representation (bulk-type polymorphism). It explains why generalizing algorithms across these dimensions is not straightforward.",{"name":119,"@type":110,"acceptedAnswer":120},"How does the paper propose addressing bulk-type support issues?",{"text":121,"@type":113},"It attempts to tackle the identified difficulties using Haskell’s constructor classes, using the language’s type system to better structure bulk-type construction and operations.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},203804,1788563995,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":39,"category_name":40,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":29,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":26},549768064622,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","Bulk with class  \ntypes  \nSimon Peyton Jones  \nUniversity of Glasgow  \nEmail:  \n[simonpj@dcs. gla. ac. uk](simonpj@dcs. gla. ac. uk)  \n.  \n[http:://www. dcs. gla. ac. uk/](http:://www. dcs. gla. ac. uk/)~simonpj  \nWWW:  \nMay 1,  \n1997  \nAbstract  \n􀀌nite  \nBulk types | such as lists, bags, sets, maps, and priority queues | are ubiquitous  \nin programming. Yet languages don't support them well, even though they have  \nmany  \nreceived a great deal of attention, especially from the database community. Haskell is currently among the culprits.  \nThis paper has two aims: to identify some of the technical di􀀎culties, and to attempt to  \naddress them using Haskell's constructor classes.  \nThis paper in the proceedings of the 1997 Haskell Workshop, Amsterdam, 7 June  \nappears  \n1997. A slightly earlier version appears in the (electronic) proceedings of the 1996 Glasgow Functional Programming Workshop:  \n[http://www. dcs. gla. ac. uk/fp/workshops/fpw96/Proceedings96. html](http://www. dcs. gla. ac. uk/fp/workshops/fpw96/Proceedings96. html)  \n1 Introduction  \nFunctional programs use a lot of lists, but often a list is actually used to represent:  \na stack, a queue, a deque, a bag, a set, a 􀀌nite map (by way of an association list of (key, value) pairs), or a priority queue.  \nUsing lists for all of these so-called bulk types is bad programming style for two reasons:  \n1. The type of the object does not specify its invariant (e. g. in a set there are no duplicates) and its expected operations (e. g. lookup in a 􀀌nite map) . The lack of these invariants harder  \nmakes the program harder to understand, harder to prove properties about, and  \nto maintain.  \n2. Operations on lists may be less e􀀎cient, or perhaps even in a di􀀋erent complexity class, than operations on a suitably optimised abstract data type. For example, list append  \n1  \n( ++) takes time linear in the size of its 􀀌rst argument, whereas it is easy to implement an  \n1  \nordered sequence ADT with constant-time concatenation  \n.  \nEveryone knows this, but still uses lists! Why? Because lists are well supported  \neveryone  \nby the language: they admit pattern matching, there is built-in syntax (list comprehensions),  \na library operate over experienced  \nand there is rich of functions that lists. Even functional  \n2  \nprogrammers knowingly write an O ( n ) algorithm where an O ( n) algorithm would do, because it is just so convenient to use lists and append them rather than to design and implement and use an abstract data type.  \nWhy, then, aren't there well-engineered libraries to support sets, bags, 􀀌nite maps, and so on? Many decent attempts have been made, notably C++'s standard template library (STL) { see  \nSection 5 { but all have technical di􀀎culties. This paper identi􀀌es some of these di􀀎culties and attacks them using Haskell's type classes.  \n2 The problem with bulk types  \nThe central di􀀎culty with bulk types is their degree of polymorphism. First, there  \nare many  \ndi􀀋erent sorts of collections | lists, sets, queues, and so on. Second, one such sort may have  \nmany di􀀋erent representation  \npossible representations | lists, trees, hash tables, and so on. may have many di􀀋erent element types | integers, booleans,  \nLastly,  \neach  \nsuch  \ncharacters,  \npairs,  \nand so on.  \nA language that supports polymorphism allows the programmer to write a single algorithm that can be used in many \\essentially similar\" situations. For example, suppose we want to construct the list (or set, or bag) of leaves of a tree, where the tree is de􀀌ned by the following data type:  \ndata Tree a = Leaf a | Branch (Tree a) (Tree a)  \nHere is a possible algorithm that works for a tree with Int leaves, constructing a set of Ints:  \nleavesSetInt :: Tree Int -> SetInt  \nleavesSetInt (Leaf a) = singletonSetInt a  \nleavesSetInt (Branch t1 t2) = leaves t1 `unionSetInt` leaves t2 This code assumes the existence of the following set construction functions:  \nsingletonSetInt :: Int-> SetInt  \nunionSetInt","cbCaijwlsV2sLCBF","https://ap.wps.com/l/cbCaijwlsV2sLCBF","pdf",246668,24,"English","# Abstract\n# Introduction\n## Bulk types represented using lists\n## Why lists are convenient yet problematic\n# The problem with bulk types\n## Degree of polymorphism\n## Element polymorphism\n# Bulk-type polymorphism","[{\"question\":\"Why are lists considered a poor way to represent bulk types in functional programs?\",\"answer\":\"Lists fail to encode invariants and expected operations in the type, making programs harder to understand, prove, and maintain. List operations may also have worse time complexity than operations on an appropriate abstract data type.\"},{\"question\":\"What two technical challenges does the paper focus on regarding polymorphism for bulk types?\",\"answer\":\"The paper discusses polymorphism both in the element type (element polymorphism) and in the collection representation (bulk-type polymorphism). It explains why generalizing algorithms across these dimensions is not straightforward.\"},{\"question\":\"How does the paper propose addressing bulk-type support issues?\",\"answer\":\"It attempts to tackle the identified difficulties using Haskell’s constructor classes, using the language’s type system to better structure bulk-type construction and operations.\"}]","Bulk Types - A Programming Approach Using Haskell Constructor Classes | PDF"]