Coder Social home page Coder Social logo

bcc222-material's Introduction

Universidade Federal de Ouro Preto
Disciplina: BCC222 - Programação Funcional
Professor: Rodrigo Geraldo Ribeiro


Primeiros passos

1.0 - Desenvolvendo Haskell

1.1 Configurando o ambiente
1.2.1 Instalando diretamente em uma máquina
1.2.2 Testando o setup de desenvolvimento em Haskell
  • No terminal, acesse a pasta aula09 e execute os comandos:
stack build 

stack exec aula09-exe

se a execução acontecer com sucesso, sua máquina está devidamente configurada.


1.3.1 Desenvolvendo num ambiente Vagrant
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "archlinux/archlinux"

  config.vm.provider "virtualbox" do |vb|
    vb.memory = "8048"
    vb.cpus = 4
  end

  config.vm.provision "shell", inline: <<-SHELL
    # Update the system
    sudo pacman -Syu --noconfirm

    # Install necessary packages
    sudo pacman -S --noconfirm base-devel git ghc cabal-install stack emacs

    # Set up Emacs for TTY mode
    echo "(setq inhibit-startup-message t)" >> /etc/skel/.emacs
    echo "(menu-bar-mode -1)" >> /etc/skel/.emacs
    echo "(tool-bar-mode -1)" >> /etc/skel/.emacs
    echo "(scroll-bar-mode -1)" >> /etc/skel/.emacs
    echo "(setq visible-bell t)" >> /etc/skel/.emacs
    echo "(setq ring-bell-function 'ignore)" >> /etc/skel/.emacs

    # Set up Haskell enviroment 
    cabal update
    stack setup

  SHELL

  config.vm.provision "shell", path: "build-and-run.sh"

end

build-and-run.sh
#!/bin/bash

# Test Haskell environment
cd /vagrant/aula09
sudo -u vagrant stack exec aula09-exe

if [ ! -d "/vagrant/slides" ]; then
    mkdir /vagrant/slides
fi

# Clone org-reveal repository
if [ ! -d "/home/vagrant/.emacs.d/org-reveal" ]; then
git clone https://github.com/yjwen/org-reveal.git /home/vagrant/.emacs.d/org-reveal
fi

# Set up Emacs for org-reveal
sudo -u vagrant echo "(add-to-list 'load-path (expand-file-name \"org-reveal\" \"~/.emacs.d\"))" >> /home/vagrant/.emacs
sudo -u vagrant echo "(require 'ox-reveal)" >> /home/vagrant/.emacs

# Install org-reveal package
sudo -u vagrant emacs --batch -l /home/vagrant/.emacs -eval '(load-library "ox-reveal")'

# Define function to export slides
echo "(defun export-slides (file) (find-file file) (org-reveal-export-to-html))" >> /home/vagrant/export.el

# Create reveal presentation
for dir in /vagrant/aula* /vagrant/extra*; do
  if [ -d "$dir" ]; then
    for file in "$dir"/*.org; do
      if [ -f "$file" ]; then
        sudo -u vagrant emacs --batch -l /home/vagrant/.emacs -l /home/vagrant/export.el --eval "(export-slides \"$file\")" 
        mv "${file%.org}.html" /vagrant/slides/
      fi
    done
  fi
done

  • Em uma maquina com vagrant instalado, execute:
- vagrant up --provision-with shell

Esse comando ira instanciar uma máquina virtual com Haskell e Emacs, além de executar o teste da Aula09 e gerar todos os slides das aulas em uma pasta /slide.

Agora basta conectar-se ao ambiente virtual para começar a desenvolver em Haskell utilizando Emacs ou Vim.


Happy hacking!

bcc222-material's People

Contributors

rodrigogribeiro avatar

Stargazers

Fernando Magno Quintão Pereira avatar Matheus Gurgel avatar Patrick Oliveira avatar Mateus Hamade avatar

Watchers

 avatar

bcc222-material's Issues

Abrindo as apresentações com Reveal.js

Professor, consegui com muito custo instalar e aprender um pouco de emacs durante o fim de semana.
Estou usando um vagrant ssh e usando emacs com o argumento -nw
segui a instalação do seguinte repositorio:
https://github.com/yjwen/org-reveal/

fazendo o seguinte:

clonei o repo dentro da pasta .emacs.d

e adicionei as seguintes linhas no .emacs que criei no home do vagrant:

(add-to-list 'load-path (expand-file-name "org-reveal" "~/.emacs.d"))
(require 'ox-reveal)

isso me possibilitou instalar o pacote, e consegui exportar o HTML.

Porem, quando abro o html em meu navegador, ele aparece apenas como texto:

Sun May  7 12:35:01 PM -03 2023

Acredito que seja porque instalei o reveal.js dentro do Guest e quando abro no Host, nao e possivel ter acesso ao reveal no guest.

Acha que se eu exportar um reveal.js para dentro do guest, resolveria esse problema?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.