unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: jgart <jgart@dismail.de>
To: Guix Help <help-guix@gnu.org>
Cc: Philip McGrath <philip@philipmcgrath.com>
Subject: Elm and Guix
Date: Tue, 13 Sep 2022 19:27:24 -0500	[thread overview]
Message-ID: <20220913192724.GB14733@dismail.de> (raw)

From: jgart <jgart@dismail.de>
To: Guix Help <help-guix@gnu.org>
Cc: Philip McGrath <philip@philipmcgrath.com>
Bcc:
Subject: Using elm with Guix
Reply-To:
In-Reply-To:

Hi,

I'v been trying to use elm with Guix at the repl and by compiling a
src/Main.elm file and elm doesn't find any of the Guix-installed dependencies:
```
 guix-shell  elm make src/Main.elm
Detected problems in 1 module.
-- MODULE NOT FOUND ----------------------------------------------- src/Main.elm

You are trying to import a `Http` module:

10| import Http
           ^^^^
I checked the "dependencies" and "source-directories" listed in your elm.json,
but I cannot find it! Maybe it is a typo for one of these names?

    Set
    Dict
    Main
    Task

Hint: Maybe you want the `Http` module defined in the elm/http package? Running
elm install elm/http should make it available!
```

Is there a way that I'm supposed to be using elm with Guix in order to discover the dependencies.

The usage of this for elm developers using Guix looks undocumented.

What I tried:

```
guix shell elm elm-json elm-html emacs-http

mkdir elm_play
cd elm_play
elm init
elm make src/Main.elm
```

Main.elm:
```
module Main exposing (..)
-- Make a GET request to load a book called "Public Opinion"
--
-- Read how it works:
--   https://guide.elm-lang.org/effects/http.html
--

import Browser
import Html exposing (Html, text, pre)
import Http



-- MAIN


main =
  Browser.element
    { init = init
    , update = update
    , subscriptions = subscriptions
    , view = view
    }



-- MODEL


type Model
  = Failure
  | Loading
  | Success String


init : () -> (Model, Cmd Msg)
init _ =
  ( Loading
  , Http.get
      { url = "https://elm-lang.org/assets/public-opinion.txt"
      , expect = Http.expectString GotText
      }
  )



-- UPDATE


type Msg
  = GotText (Result Http.Error String)


update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
  case msg of
    GotText result ->
      case result of
        Ok fullText ->
          (Success fullText, Cmd.none)

        Err _ ->
          (Failure, Cmd.none)



-- SUBSCRIPTIONS


subscriptions : Model -> Sub Msg
subscriptions model =
  Sub.none



-- VIEW


view : Model -> Html Msg
view model =
  case model of
    Failure ->
      text "I was unable to load your book."

    Loading ->
      text "Loading..."

    Success fullText ->
      pre [] [ text fullText ]

```

wdyt


             reply	other threads:[~2022-09-14  0:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  0:27 jgart [this message]
2022-09-14  4:18 ` Elm and Guix Philip McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220913192724.GB14733@dismail.de \
    --to=jgart@dismail.de \
    --cc=help-guix@gnu.org \
    --cc=philip@philipmcgrath.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).