Auxiliary Memory
  • Auxiliary Memory
  • Recent Changes
  • Disclaimer
  • general
    • Homelab
      • Planning
      • Configuring RPi
      • Dockerize Unifi Controller
      • Moving Unifi Controller to Bare Metal RPi
    • Lifehack
      • Coding on iPad
      • Faster internet with Cloudflare WARP
  • lifelog
    • Links
    • Movies
    • Books
      • Reading Queue
    • Public Memos
      • 2020 Memo
    • Yearly Records
      • Records of 2020
      • Records of 2019
  • books
    • The Rust Programming Language
    • Lambda Calculus
    • SICP
    • Introduction To Algorithms
      • 1.1. 알고리즘의 역할
      • 1.2. 시작하기
    • Linux System Programming 2/E
      • 1. 핵심 개념 소개
  • Programming
    • Git
    • When to refactoring?
    • Microservices
    • Functional Programming
      • ADT
      • Functor and Monads
    • OS
      • CPU Modes
    • Debugging
      • objdump
    • DevOps
      • How our infrastructure organized
      • Optimize Dockerfile
    • Spring Framework
    • Web
      • OAuth
        • Sign in with Apple
    • SQL
      • Prepared Statement
    • Programming Languages
      • TypeScript
      • Python
        • GIL
      • Rust
      • F#
        • Dos & Don'ts
      • Go
      • JVM
        • JVM memory structure
        • JVM GC
        • Kotilin
        • Java
          • Why main method should be static
  • My Environment
    • My Macbook
    • My Keyboards
    • My PyCharm
    • My CLI
      • iTerm2
      • Dotfiles
        • Refactoring .zshrc
      • Useful Commands
Powered by GitBook
On this page
  • ADT
  • 곱 타입
  • 합 타입
  • References

Was this helpful?

  1. Programming
  2. Functional Programming

ADT

ADT

프로그래밍, 특히 함수형 프로그래밍과 타입 이론에서 ADT는 여러가지 원시 타입의 조합힌 합성 타입의 일종이다. 크게 곱(Product) 타입과 합(Sum) 타입으로 나누어진다.

ADT의 값들은 패턴 매칭을 통해 분석된다.

곱 타입

흔히 튜플, 레코드, 구조체 타입 등으로 불리는 타입이다.

곱 타입은 각 타입이 가질수 있는 값의 개수들을 곱한 만큼의 인스턴스를 가질 수 있다.

다음의 튜플은 int 집합 * int 집합 만큼의 인스턴스를 가질 수 있다.

type intAndInt = int * int

합 타입

태그드 유니언, 열거형 등으로 불리는 타입이다.

다음의 Option 타입은 Some<T> 또는 Empty라는 것을 나타낸다. 따라서 다음의 유니온이 가질 수 있는 인스턴스의 개수는 Some<T> + None 만큼이다.

type Option<'a> =
   | Some of 'a
   | None

References

PreviousFunctional ProgrammingNextFunctor and Monads

Last updated 5 years ago

Was this helpful?

https://fsharpforfunandprofit.com/posts/tuples/
https://fsharpforfunandprofit.com/posts/discriminated-unions/
https://en.wikipedia.org/wiki/Algebraic_data_type