Can't import .lhs script in Haskell - haskell

I have two files, S5.hs and S6.lhs, in the same folder, and I want to import the S6.lhs script in S5.hs, but when i type import S6, i get:
Could not find module `S6'
Use -v to see a list of the files searched for.
|
1 | import S6
| ^^^^^^^^^^
Failed, no modules loaded.
When I lauch it from the folder, I get following message(the first line of the S6 file is import Data.Array):
File name does not match module name:
Saw: `Main'
Expected: `S6'
|
1 | import Data.List
| ^
Why is this happening?

Looks like you need to specify at the top of the S6.lhs file that you want this file to be treated as the S6 module, as opposed to the default module name of Main. You would do that with module S6 where or module S6 (export, list) where.

Related

Could not load my own modules in ghci haskell

i am trying to load a module called Point.hs into a file called Circle.hs by this way:
module Figures.Circle
( Circle(..)
, getArea
, getPerimeter
) where
import qualified Figures.Point as P
here is my Point.hs file:
module Figures.Point
( Point(..)
) where
this is my directory´s tree:
Figures/
Point.hs
Circle.hs
and this is what ghci´s error says:
Circle.hs:7:1: error:
Could not find module `Figures.Point'
Locations searched:
Figures\Point.hs
Figures\Point.lhs
Figures\Point.hsig
Figures\Point.lhsig
|
7 | import qualified Figures.Point as P
I follow this guide.
I get the same error if I call ghci from within the Figures directory, that can be avoided by calling ghci from the parent directory, so ghci Figures\Circle.hs.

ImportError: cannot import name 'test' from 'lib'

as you can see in the picture down below, I created a TEST package, with two sub-packages(test1, test2), this is the structure of the package:
\test
| __pycache__.py # ki importit lib fell main tcrea
| __init__.py
| lib.py
| \test1
| | __init__.py
| | test1.py
| \test2
| | __init__.py
| | test2.py
I wanted to import lib inside test1.py
I have tried the next code( as I sawed in the tutorials):
import lib
lib.test()
# from lib import test
# test()
# from ..lib import test
# test()
I tried to execute the code with vs code cmd from the TEST package then I entered to test1 sub-package(cd .\test1) to try but it didn't work.
I got those errors:
THANKS FOR HELP!!

Compiling Rocket in Bazel

I'm attempting to get a working prototype of the following scenario:
Language: Rust (rustc 1.45.0-nightly (ad4bc3323 2020-06-01))
Framework: Rocket v0.4.4
Build Tool: Bazel
Platform: Mac OS X / Darwin x64
Running bazel build //web-api yields the below error. I believe, based on looking at the Cargo.lock file it is because Rocket's dependency on the hyper library specifies a dependency on the log 0.3.9 library. For whatever reason it is not using the more recent log=0.4.x. That said, I don't know why it's pulling this library since, if I build it manually, it works fine.
ERROR: /private/var/tmp/_bazel_nathanielford/2a39169ea9f6eb02fe788b12f9eae88f/external/raze__log__0_3_9/BUILD.bazel:27:1: error executing shell command: '/bin/bash -c CARGO_MANIFEST_DIR=$(pwd)/external/raze__log__0_3_9 external/rust_darwin_x86_64/bin/rustc "$#" --remap-path-prefix="$(pwd)"=__bazel_redacted_pwd external/raze__log__0_3_9/src/lib.rs -...' failed (Exit 1) bash failed: error executing command /bin/bash -c 'CARGO_MANIFEST_DIR=$(pwd)/external/raze__log__0_3_9 external/rust_darwin_x86_64/bin/rustc "$#" --remap-path-prefix="$(pwd)"=__bazel_redacted_pwd' '' external/raze__log__0_3_9/src/lib.rs ... (remaining 24 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
error[E0425]: cannot find function `set_logger` in crate `log`
--> external/raze__log__0_3_9/src/lib.rs:731:16
|
731 | match log::set_logger(&ADAPTOR) {
| ^^^^^^^^^^ not found in `log`
|
help: consider importing this function
|
204 | use set_logger;
|
The following is my directory structure:
/
|-WORKSPACE
|-BUILD # Empty
|-web-api/
| |-BUILD
| |-src/
| | |-main.rs
| |-cargo/
| |-Cargo.toml
| |-Cargo.lock
| |-BUILD.bazel
| |-remote/
| |-... (Cargo-raze files)
In order to set up the cargo-raze I did the following, following instructions from the github page.:
$ cd web-api/cargo
$ cargo generate-lockfile
$ cargo vendor --versioned-dirs --locked
$ cargo raze
(The generate-lockfile is what creates the Cargo.lock file, and the cargo raze is what creates the BUILD.bazel file and all the contents of the remote sub directory.)
And then to execute the bazel build I go back to the root and run bazel build //web-api, which produces the above error.
This is my WORKSPACE file:
workspace(name = "rocket-bazel")
load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_rust",
sha256 = "f21c67fc2fef9d57fa3c81fde1defd9e57d451883388c0a469ec1c470fd30dcb",
strip_prefix = "rules_rust-master",
urls = [
"https://github.com/bazelbuild/rules_rust/archive/master.tar.gz"
],
)
http_archive(
name = "bazel_skylib",
sha256 = "9a737999532daca978a158f94e77e9af6a6a169709c0cee274f0a4c3359519bd",
strip_prefix = "bazel-skylib-1.0.0",
url = "https://github.com/bazelbuild/bazel-skylib/archive/1.0.0.tar.gz",
)
load("#io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
rust_repositories(version="nightly", iso_date="2020-06-02")
load("#io_bazel_rules_rust//:workspace.bzl", "bazel_version")
bazel_version(name = "bazel_version")
load("//web-api/cargo:crates.bzl", "raze_fetch_remote_crates")
raze_fetch_remote_crates()
This is my web-api/BUILD file:
load("#io_bazel_rules_rust//rust:rust.bzl", "rust_binary")
rust_binary(
name = "web-api",
srcs = ["src/main.rs"],
deps = [
"//web-api/cargo:rocket",
],
)
And my web-api/cargo/Cargo.toml file:
load("#io_bazel_rules_rust//rust:rust.bzl", "rust_binary")
rust_binary(
name = "web-api",
srcs = ["src/main.rs"],
deps = [
"//web-api/cargo:rocket",
],
)
I've run out of ideas as to what to try. I can get this to compile without Bazel, just using rust (though obviously the files are in slightly different places). I can get it to compile inside a Docker container. I just can't get Bazel (necessarily with cargo raze, either in vendor or remote mode) to run successfully: I assume that there is some mismatch in compile target or the nightly build that is not being properly set - but I'm not sure how to diagnose or get past that.
Here is a link to a repository with the files/structure I tried.
I had a similar issue when I made a minimal Bazel workspace with rust and the log crate together with env_logger crate. I found a similar issue when you try to compile without features = ["std"]. I then tried to enable that in Cargo.toml on the log dependency without success.
My solution is that in Cargo.toml under [raze] I added:
default_gen_buildrs = true
I could trace it down to that when default_gen_buildrs flag is not set in the generated log crate the BUILD.bazel file did not have a cargo_build_script definition or this:
crate_features = [
"std",
],

pywinatuo - Access Database Match Error for the same property - Code works on a small database not on a large one

I am trying to run some access queries using pywinauto. The error Constantly changes.
After checking the control properties i found that the query name does exist. However the the code throws an error stating match not found.
import os
import subprocess
access_file = r'C:\Ren'
filename='test.accdb'
accessPath = 'C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.exe'
subprocess.Popen([accessPath,access_open])
dlg=Desktop(backend='uia').window(title_re='Access*')
sleep(10)
dlg.Navigation_Pane.Queries.Query1.invoke()
dlg.Yes.invoke()
print(dlg.print_control_identifiers())
This code works on a smaller database. I Tried it 1st on a large database and got errors so i created a test database with few tables and queries. It works fine.
When i change dlg.Navigation_Pane.Queries.delete_reports.invoke()
and change the path to the actual database. I get a MatchError: Could not find 'Queries'.
This is the control properties.
GroupBox - 'Queries' (L4, T2979, R429, B5581)
| | | | ['Queries', 'QueriesGroupBox', 'GroupBox8', 'Queries0', 'Queries1']
| | | | child_window(title="Queries", control_type="Group")
Button - 'delete report' (L4, T3271, R429, B3301)
| | | | | ['Button147', 'delete reportButton', 'delete report']
| | | | | child_window(title="delete report", control_type="Button")
I am unable to understand why does it one work on one database and does not on the other.
Regards,
Ren.

You may need an appropriate loader to handle this file - .net core & Angular

I keep getting the following error web running a production build of a .net core angular 4 application. Those are 2 node packages I installed and looks like their is some issue with webpack reading those files only for production builds. Any thoughts?
ERROR in ./$$_gendir/~/ngx-mydatepicker/dist/ngx-my-date-picker.component.ngfactory.ts
Module parse failed: d:\a\1\s\Vacant2\$$_gendir\node_modules\ngx-mydatepicker\dist\ngx-my-date-picker.component.ngfactory.ts Unexpected token (14:28)
You may need an appropriate loader to handle this file type.
| import * as i3 from 'ngx-mydatepicker/dist/directives/ngx-my-date-picker.focus.directive';
| import * as i4 from 'ngx-mydatepicker/dist/services/ngx-my-date-picker.util.service';
| const styles_NgxMyDatePicker:any[] = ['.ngxmdp .headertodaybtn,.ngxmdp .monthcell,.ngxmdp .weekdaytitle{overflow:hidden;white-space:nowrap}.ngxmdp *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:Arial,Helvetica,sans-serif;padding:0;margin:0}.ngxmdp .selector{position:absolute;padding:0;border:1px solid #CCC;border-radius:4px;z-index:100000;animation:selectorfadein 60ms}.ngxmdp .selector:focus{border:1px solid #ADD8E6;outline:0}#keyframes selectorfadein{from{opacity:0}to{opacity:1}}.ngxmdp .selectorarrow{background:#FAFAFA;padding:0}.ngxmdp .selectorarrow:after,.ngxmdp .selectorarrow:before{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute}.ngxmdp .selectorarrow:after{border-color:rgba(250,250,250,0);border-bottom-color:#FAFAFA;border-width:10px;margin-left:-10px}.ngxmdp .selectorarrow:before{border-color:rgba(204,204,204,0);border-bottom-color:#CCC;border-width:11px;margin-left:-11px}.ngxmdp .selectorarrow:focus:before{bord...
| export const RenderType_NgxMyDatePicker:i0.RendererType2 = i0.ɵcrt({encapsulation:2,
| styles:styles_NgxMyDatePicker,data:{}});
# ./$$_gendir/ClientApp/app/app.module.server.ngfactory.ts 10:0-115
# ./ClientApp/boot.server.ts
ERROR in ./$$_gendir/~/ngx-loading/ngx-loading.ngfactory.ts
Module parse failed: d:\a\1\s\Vacant2\$$_gendir\node_modules\ngx-loading\ngx-loading.ngfactory.ts Unexpected token (12:35)
You may need an appropriate loader to handle this file type.
| import * as i1 from 'ngx-loading';
| import * as i2 from '#angular/common';
| export const LoadingModuleNgFactory:i0.NgModuleFactory<i1.LoadingModule> = i0.ɵcmf(i1.LoadingModule,
| ([] as any[]),(_l:any) => {
| return i0.ɵmod([i0.ɵmpd(512,i0.ComponentFactoryResolver,i0.ɵCodegenComponentFactoryResolver,
# ./$$_gendir/ClientApp/app/components/app/app.component.ngfactory.ts 9:0-94
# ./$$_gendir/ClientApp/app/app.module.server.ngfactory.ts
# ./ClientApp/boot.server.ts
I found the solution here https://github.com/aspnet/JavaScriptServices/issues/1168#issuecomment-320026397
Just needed to remove include: /ClientApp/ from myh webpack.config.js.

Resources