---
- name: Add the unofficial GHC PPA
  apt_repository: repo="ppa:hvr/ghc" state=present

- name: Install the basic Haskell packages
  apt: name={{ item }} state=latest
  with_items:
    - alex-{{ alex_version }}
    - ghc-{{ ghc_version }}
    - happy-{{ happy_version }}
    - cabal-install-{{ cabal_install_version }}

- name: Add the Haskell tools to $PATH
  template: src=haskell.sh.j2 dest=/etc/profile.d/haskell.sh

- name: Update cabal's cache
  sudo: True
  sudo_user: "{{ interactive_user }}"
  command: cabal update creates=/home/{{ interactive_user }}/.cabal/packages/hackage.haskell.org
  when: interactive_user is defined


---
- name: Add the unofficial GHC PPA
  apt_repository: repo="ppa:hvr/ghc" state=present

- name: Add the FP Complete apt key
  apt_key: url=https://s3.amazonaws.com/download.fpcomplete.com/ubuntu/fpco.key state=present

- name: Add the FP Complete repository
  apt_repository: repo="deb http://download.fpcomplete.com/ubuntu/{{ ansible_distribution_release }} stable main" state=present

- name: Install the basic Haskell packages
  apt: name={{ item }} state=latest
  with_items:
    - alex-{{ alex_version }}
    - ghc-{{ ghc_version }}
    - happy-{{ happy_version }}
    - cabal-install-{{ cabal_install_version }}
    - stack

- name: Add the Haskell tools to $PATH
  template: src=haskell.sh.j2 dest=/etc/profile.d/haskell.sh

- name: Update cabal's cache
  sudo: True
  sudo_user: "{{ interactive_user }}"
  command: cabal update creates=/home/{{ interactive_user }}/.cabal/packages/hackage.haskell.org
  when: interactive_user is defined


Add stack to Haskell role.
Add stack to Haskell role.
