首页 > 其他分享 >Haskell 入门 - 零碎版

Haskell 入门 - 零碎版

时间:2023-09-30 13:33:47浏览次数:33  
标签:kind declarations 入门 Type constructors 零碎 Haskell type Types

Haskell 2010

4. Declarations and Bindings

4.1 Overview of Types and Classes

4.1.2 Syntax of Types

  • Type variables
  • Type constructors
    • type constants with kind ∗
    • types with kind ∗ → ∗
    • built-in type constructors
      • trivial type, as () with *
      • function type, as (->), kind ∗ → ∗ → ∗
      • list type, as [], kind ∗ → ∗
      • tuple types, as (,), (,,), and so on, kind ∗ → ∗ → ∗ and so on.
    • Special syntax, built-in type constructors for functions, tuples, and lists,
      • function type, t1 -> t2
      • tuple type, (t1, . . . , tk) 
      • list type, [t]
  • Type application, 接收类型化参数,具化为新类型
  • A parenthesized type, form (t), is identical to the type t.

4.2 User-Defined Datatypes

  • algebraic datatypes (data declarations)
  • renamed datatypes (newtype declarations)
  • type synonyms (type declarations)

4.2.1 Algebraic Datatype Declarations

示例:



-- libraries/ghc-prim/GHC/Types.hs
data List a = [] | a : List a

 

标签:kind,declarations,入门,Type,constructors,零碎,Haskell,type,Types
From: https://www.cnblogs.com/UPeRVv/p/17737050.html

相关文章

  • python继续入门
    ifname=="main"#错这段代码执行时不会进入if语句里的代码块是因为if__name__=="__main__":条件判断中的"main"应为"__main__"才能执行。所以你需要将条件判断改为if__name__=="__main__":,这样才能执行if语句里的代码块。if__name__=="__main__": ......
  • Galgame封包逆向入门
    Galgame封包逆向入门这里就简单聊一下封包逆向分析的一些注意点吧,其实也是初入逆向的注意点了,本质差不多。正向基础语言基础:ASM、C、C++平台基础:Win32、PE、GDI、DirectX引擎基础:游戏引擎架构虽然说的逆向,其实和正向的水平、见识、经验是强相关的,如果你没写过相关的程序又......
  • python入门
    1、python数据类型: 列表对应Java中的list可以添加删除元素,格式是中括号,A=['xiaoWang','xiaoZhang','xiaoHua'];元组对应Java中的数组,长度是固定的不能修改,格式是小括号,tuple=('刘备','关于','张飞');字典对应Java中的map,tuple=('刘备','关于�......
  • OI 超几何函数入门
    第一章定义超几何函数\[F(a_1,a_2\dotsa_n;b_1,b_2\dotsb_m;z)=\sum_{k\ge0}\frac{a_1^{\overline{k}}\dotsa_n^{\overline{k}}z^k}{b_1^{\overlinek}\dotsb_n^{\overlinek}k!}\]其中\(b_i\)不为非正的整数。举出若干简单例子:\[F(1;1;z)=e^z,F(1,1;1;z)=\frac{1}{1......
  • GDB调试入门(一)
    GDB调试入门(一)嵌入式er终极理想稚晖君 6人赞同了该文章当代码量较多时,使用GDB调试代码可以相对便捷的定位错误点,提高Dbug效率。首先先熟悉下GDB调试的基本流程:1.在编译代码是添加gcc添加–g选项:gcc-gtest.c-otest.out2.然后在bash环境中使用GD......
  • 100天精通Golang(基础入门篇)——第2天:学习Go语言的前世今生:一门强大的编程语言的崛起
    ......
  • Ubuntu20.04 入门ip ssh 源
    sudovi/etc/netplan/00-installer-config.yamlnetwork:version:2ethernets:ens32:dhcp4:falseaddresses:[192.168.1.5/24]gateway4:192.168.1.1nameservers:addresses:[114.114.114.114]#addresses:192.168.1.5/24]......
  • rabbitmq快速入门
    镜像启动命令dockerrun\-eRABBITMQ_DEFAULT_USER=root\-eRABBITMQ_DEFAULT_PASS=123456\--namemq\--hostnamemq1\-p15672:15672\-p5672:5672\-d\rabbitmq:3-management   ......
  • Web-入门-SpringBoot快速入门 创建springboot web项目
    web入门spring官网spring发展到今天已经形成了一种开发生态圈,spring提供了若干个子项目,为每个项目用于完成特定的功能。这些框架都是基于一个基础框架:直接基于SpringFramework基础框架进行开发会有两大难题:1.配置繁琐。2.入门难度大。所以spring家族意识到了这一点,......
  • Kafka入门经典教程
    1.Kafka独特设计在什么地方?2.Kafka如何搭建及创建topic、发送消息、消费消息?3.如何书写Kafka程序?4.数据传输的事务定义有哪三种?5.Kafka判断一个节点是否活着有哪两个条件?6.producer是否直接将数据发送到broker的leader(主节点)?7.Kafaconsumer是否可以消费指定分区消息?8.Kafka消息......