Wednesday, July 08, 2020

How to use a personal library in another project with Stack? (Haskell)



In Haskell, Haskell tool stack is quite difficult at least to me. For example, I want to use a personal library (a pre-release version of a Hackage package) from a stack project  in another stack project. Conceptually, it is simple, but it takes a bit long to find a solution from Stackoverflow.

Here is a summary.

In stack.yaml

packages 
- '.'
- path-to-a-stack-project-directory-containing-your-personal-library

In packages.yaml

dependencies:
- your-personal-libary

Then run 

$ stack build

This will solve your need. How easy it is after one knows how to do it! But I worry how difficult Haskell newbies may feel. 


Saturday, July 04, 2020

Switching between my office and my home working on the same working branch (Git, GitHub)

I am still a newbie to Git and GitHub. I have recently started using the notion of branches. In my office, I work on master and working branches, and I always push them to GitHub before I get back home. At my home, I work with my home computer. So I clone the GitHub repository. What I want to do is to work on the working branch and to push whatever I work on at home later.

This is what I need to do at home for this purpose.

$ git clone https://github.com/kwanghoon/polyrpc

$ cd polyrpc

$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/working_erasure

$ git checkout origin/working_erasure
주의: 'origin/working_erasure' 체크아웃하기.

지금 'HEAD가 분리된' 상태입니다. 이 상태에서는 여기저기 돌아보고,
실험적으로 바꾸고 커밋하더라도, 체크아웃할 수 있는 다른 브랜치에
영향을 미치지 않고 변경 사항을 잃어버릴 수 있습니다.

커밋을 유지하는 브랜치를 새로 만드려면, (지금이든 나중이든) 체크아웃
명령을 다시 하면서 -b 옵션을 사용하면 됩니다. 예를 들어:

  git checkout -b <새-브랜치-이름>

HEAD의 현재 위치는 1597a06 Added some options to switch between typed and untyped runnings; Default is the typed running; Bugs in the erasure pass

$ git branch -a 
* (HEAD origin/working_erasure 위치에서 분리됨)
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/working_erasure

$ git checkout working_erasure
'working_erasure' 브랜치가 리모트의 'working_erasure' 브랜치를 ('origin'에서) 따라가도록 설정되었습니다.
새로 만든 'working_erasure' 브랜치로 전환합니다

$ git branch
  master
* working_erasure

$