Giter VIP home page Giter VIP logo

Comments (2)

Fuuzetsu avatar Fuuzetsu commented on May 18, 2024

Hi! This works just fine for me

load(
  "@io_tweag_rules_haskell//haskell:haskell.bzl",
  "haskell_library",
  "haskell_toolchain",
  "haskell_cc_import",
)

haskell_toolchain(
  name = "vector-toolchain",
  version = "8.2.2",
  tools = "@vector-toolchain//:bin",
)

cc_library(
  name = "cbits",
  hdrs = ["include/vector.h", "internal/unbox-tuple-instances"],
)

haskell_library(
  name = "vector",
  srcs = glob(["Data/**/*.*hs"]),
  visibility = ["//visibility:public"],
  prebuilt_dependencies = [
    "base",
    "deepseq",
    "ghc-prim",
    "primitive",
    "semigroups"
  ],
  deps = [":cbits"]
)

for full reference here's the WORKSPACE file that I'm using too

workspace(name = "uk_co_fuuzetsu_vector")

http_archive(
 name = "io_tweag_rules_haskell",
 strip_prefix = "rules_haskell-2c251d31eec5f0cd0d551f8b76b6b04157fe11e2",
 urls = ["https://github.com/tweag/rules_haskell/archive/2c251d31eec5f0cd0d551f8b76b6b04157fe11e2.tar.gz"]
)

http_archive(
  name = "io_tweag_rules_nixpkgs",
  strip_prefix = "rules_nixpkgs-53700e429928530f1566cfff3ec00283a123f17f",
  urls = ["https://github.com/tweag/rules_nixpkgs/archive/53700e429928530f1566cfff3ec00283a123f17f.tar.gz"],
)

# Required due to rules_haskell use of skylib.
http_archive(
  name = "bazel_skylib",
  strip_prefix = "bazel-skylib-0.2.0",
  urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.2.0.tar.gz"]
)

load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
     "nixpkgs_git_repository",
     "nixpkgs_package",
)

nixpkgs_git_repository(
  name = "nixpkgs",
  revision = "4026ea9c8afd09b60896b861a04cc5748fdcdfb4",
)

nixpkgs_package(
  name = "vector-toolchain",
  repository = "@nixpkgs",
  nix_file_content = """
let pkgs = import <nixpkgs> {};
in pkgs.buildEnv {
  name = "vector-toolchain";
  paths = with pkgs; [
    (haskell.packages.ghc822.ghcWithPackages (p: with p;
       [ base
         deepseq
         ghc-prim
         primitive
         semigroups
       ]
     ))
  ];
}
"""
)

register_toolchains("//:vector-toolchain")
[nix-shell:~/programming/vector]$ bazel build //:vector
/nix/store/n2wx4l0j76s1b3rnq7an5jahlmqlnpw9-vector-toolchain
INFO: Analysed target //:vector (10 packages loaded).
INFO: Found 1 target...
INFO: From Compiling vector:
[ 1 of 21] Compiling Data.Vector.Fusion.Util ( Data/Vector/Fusion/Util.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Fusion/Util.o )
[ 2 of 21] Compiling Data.Vector.Fusion.Bundle.Size ( Data/Vector/Fusion/Bundle/Size.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Fusion/Bundle/Size.o )
[ 3 of 21] Compiling Data.Vector.Generic.Mutable.Base ( Data/Vector/Generic/Mutable/Base.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Generic/Mutable/Base.o )
[ 4 of 21] Compiling Data.Vector.Generic.Base ( Data/Vector/Generic/Base.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Generic/Base.o )
[ 5 of 21] Compiling Data.Vector.Internal.Check ( Data/Vector/Internal/Check.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Internal/Check.o )
[ 6 of 21] Compiling Data.Vector.Fusion.Stream.Monadic ( Data/Vector/Fusion/Stream/Monadic.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Fusion/Stream/Monadic.o )
[ 7 of 21] Compiling Data.Vector.Fusion.Bundle.Monadic ( Data/Vector/Fusion/Bundle/Monadic.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Fusion/Bundle/Monadic.o )
[ 8 of 21] Compiling Data.Vector.Fusion.Bundle ( Data/Vector/Fusion/Bundle.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Fusion/Bundle.o )
[ 9 of 21] Compiling Data.Vector.Generic.Mutable ( Data/Vector/Generic/Mutable.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Generic/Mutable.o )
[10 of 21] Compiling Data.Vector.Generic.New ( Data/Vector/Generic/New.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Generic/New.o )
[11 of 21] Compiling Data.Vector.Generic ( Data/Vector/Generic.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Generic.o )
[12 of 21] Compiling Data.Vector.Mutable ( Data/Vector/Mutable.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Mutable.o )
[13 of 21] Compiling Data.Vector      ( Data/Vector.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector.o )
[14 of 21] Compiling Data.Vector.Primitive.Mutable ( Data/Vector/Primitive/Mutable.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Primitive/Mutable.o )
[15 of 21] Compiling Data.Vector.Primitive ( Data/Vector/Primitive.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Primitive.o )
[16 of 21] Compiling Data.Vector.Storable.Internal ( Data/Vector/Storable/Internal.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Storable/Internal.o )
[17 of 21] Compiling Data.Vector.Storable.Mutable ( Data/Vector/Storable/Mutable.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Storable/Mutable.o )
[18 of 21] Compiling Data.Vector.Storable ( Data/Vector/Storable.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Storable.o )
[19 of 21] Compiling Data.Vector.Unboxed.Base ( Data/Vector/Unboxed/Base.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Unboxed/Base.o )
[20 of 21] Compiling Data.Vector.Unboxed ( Data/Vector/Unboxed.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Unboxed.o )
[21 of 21] Compiling Data.Vector.Unboxed.Mutable ( Data/Vector/Unboxed/Mutable.hs, bazel-out/k8-fastbuild/bin/objects-vector-1.0.0/Data/Vector/Unboxed/Mutable.o )
INFO: From SkylarkAction vector-1.0.0:
Reading package info from "bazel-out/k8-fastbuild/bin/registration-file-vector-1.0.0" ... done.
Target //:vector up-to-date:
  bazel-bin/vector-1.0.0/vector-1.0.0.conf
  bazel-bin/vector-1.0.0/package.cache
INFO: Elapsed time: 9.302s, Critical Path: 8.32s
INFO: Build completed successfully, 6 total actions

I am closing the issue but let me know how it goes and please re-open if you hit any difficulties.

from rules_haskell.

iphydf avatar iphydf commented on May 18, 2024

Cool, thanks. That works. I misunderstood the need to use haskell_cc_import.

from rules_haskell.

Related Issues (20)

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.